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

Research Spike: Volar #298

Closed
4 tasks done
ChristianMurphy opened this issue Feb 11, 2023 · 2 comments · Fixed by #340
Closed
4 tasks done

Research Spike: Volar #298

ChristianMurphy opened this issue Feb 11, 2023 · 2 comments · Fixed by #340
Assignees
Labels
🏗 area/tools This affects tooling 💪 phase/solved Post is done 💬 type/discussion This is a request for comments

Comments

@ChristianMurphy
Copy link
Member

ChristianMurphy commented Feb 11, 2023

Initial checklist

Problem

There is a fair amount of boilerplate code to integrate MDX, TypeScript, and the language server together.
This boilerplate may not be necessary with some abstraction.

Solution

Research Volar https://blog.vuejs.org/posts/volar-a-new-beginning.html
Formerly the vue language server, which has now split out it's abstractions for other language servers to use.

Volar.js is architected to support any file format that involves embedded languages - not just Vue, but also Astro, Svelte, or even Angular. It is also capable of implementing regular single-language LSP servers such as TypeScript, CSS, and HTML.

Another major focus of Volar.js is performance. It aims to minimize the overhead to achieve the performance of a native embedded language service. There are many issues and optimization opportunities that could only be discovered over time with a sizable user base, and Volar.js is optimized based on the learnings we have accumulated from millions of downloads.

The abstractions appear to center around low level details:

we abstract all the places you don't need to care about, such as virtual code mapping, formatting edits merge etc.

We may be able to rebase our server on top of that foundational work.

Alternatives

Volar is new, and may or may not suit vscode-mdx.
This is mostly an issue to explore feasibility and practicality of leveraging it.
If none of it matches, "we shouldn't use it", is a perfectly valid outcome.

Or a more piecemeal approach of leveraging concepts and reusing some functions could also be taken.

@ChristianMurphy ChristianMurphy mentioned this issue Feb 11, 2023
4 tasks
@ChristianMurphy ChristianMurphy added help wanted 🙏 This could use your insight or help 🏗 area/tools This affects tooling 💬 type/discussion This is a request for comments labels Feb 13, 2023
@remcohaszing
Copy link
Member

I recognize a lot of the ideas and troubles mentioned in that blog post. I’ll contact them and see if we can work together. 😄

@remcohaszing remcohaszing self-assigned this Feb 17, 2023
remcohaszing added a commit that referenced this issue Aug 18, 2023
- Volar handles the mapping between TypeScript and LSP.
- Volar handles the mapping between TypeScript and Monaco editor.
- Volar manages virtual files.
- Volar imports TypeScript directly. As a result, the Monaco editor
  integration now requires `path` to be polyfilled.
- It is no longer possible to pass compiler options in the Monaco editor
  integration.
- This adds editor features for YAML based on `yaml-language-server`.
  This has been contributed upstream to Volar and is pending review.
- Markdown features are now handled by
  `vscode-markdown-languageservice`. This will be contributed upstream
  to Volar soon.
- Markdown definitions are broken due to a bug in Volar.
- This adds `remark-frontmatter` with TOML and YAML support as well as
  `remark-gfm` by default unless specified otherwise in `tsconfig.json`.
- The language server now requires `typescript.tsdk` to be passed via
  initialization options.
- This adds support for debugging virtual documents using Volar labs.

Closes #168
Closes #284
Closes #295
Closes #298
Closes #301
@remcohaszing
Copy link
Member

Released in vscode-mdx@1.5.0, @mdx-js/language-server@0.2.0, @mdx-js/language-service@0.2.0 🎉

@wooorm wooorm added the 💪 phase/solved Post is done label Nov 9, 2023
@github-actions github-actions bot removed the help wanted 🙏 This could use your insight or help label Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏗 area/tools This affects tooling 💪 phase/solved Post is done 💬 type/discussion This is a request for comments
Development

Successfully merging a pull request may close this issue.

3 participants