mdx-js / mdx-analyzer

MDX extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=unifiedjs.vscode-mdx
MIT License
347 stars 21 forks source link

Research Spike: Volar #298

Closed ChristianMurphy closed 1 year ago

ChristianMurphy commented 1 year ago

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.

remcohaszing commented 1 year ago

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. :smile:

remcohaszing commented 1 year ago

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