Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Volar #294

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft

Migrate to Volar #294

wants to merge 23 commits into from

Conversation

AngusMorton
Copy link

@AngusMorton AngusMorton commented Nov 2, 2024

This is a proof of concept that shows what it might look like if the Marko Language Tools migrated to Volar as a base. If it's a direction you're interested in, I'm happy to contribute as it resolves some issues we've been having. Otherwise, I'll likely attempt to maintain it as a fork for us to use internally.

This proof-of-concept is roughly complete for our purposes, I've been using it for about a week in our codebase with no real issues.

Motivation and Context

Migrating to Volar resolves the issues we've had with the VSCode plugin on Windows (#240), and it improves the responsiveness of the plugin on Windows.

Why Volar?

  • Volar provides the glue code that the Marko Langauge Tools currently implement themselves, which means we could potentially shift the maintenance/implementation burden off the Marko team.
  • Volar is used by Vue and Astro for their Language Tools, so it's fairly well used.
  • The patterns in Volar are very similar to what is already here, so the migration is fairly straight-forward.
    • MarkoFile -> MarkoVirtualCode
    • Plugin -> LanguageServicePlugin

TODO

This is fairly untested, I mostly hacked it up so it works with our project.

  • Fix tests.
    • Some failures are likely related to changes in how the plugin delegates to other plugins (e.g. CSS Volar plugin uses a different method to get editor actions).
    • Others I'm not too sure about, looks like TS doesn't seem to fully work in the testcases but does work in the IDE. Probably just a config issue...
  • Test with non-TS projects / more project structures.

Copy link

changeset-bot bot commented Nov 2, 2024

⚠️ No Changeset found

Latest commit: 04d6eaf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment on lines +42 to +50
if (!prettier) {
// Fallback to the built-in version of prettier.
prettier = prettierBuiltIn;
}

if (!prettierPlugin) {
// Fallback to the built-in version of prettier-plugin-marko.
prettierPlugin = markoPrettier;
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, this is a change to the existing tools. We use the version from the workspace if it exists and fallback to the one built into the plugin if there isn't one in the workspace.

@DylanPiercey
Copy link
Contributor

@AngusMorton I appreciate your work and exploration on this and I think it looks good.

Right now our biggest priority is getting Marko 6 into a good/usable state and I wan't to avoid spending too much time on tooling related stuff until we get there.

I think it would be very good if you maintained this as a fork (and separately published extension) for some time until we can get back to it and review/consider it more seriously. I'm thinking some time in the new year we could work to bring this in and adopt Volar.

@AngusMorton
Copy link
Author

Sounds good! :)

I've published it as an extension and will aim to keep it in sync with this repo.

Let me know if I can contribute if/when you decide to adopt Volar, I'm more than happy to help however I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants