volar-plugins
volar-plugins copied to clipboard
Implement volar-service-langium package
This would make it possible to define a new language with langium and use it through volarjs.
Langium is a DSL design-language, or general language definition language. This might be usefull for those who want to implement their own programming language, with its own syntax, and still make use of Volar and all its capabilities (for example embedding languages together).
Interesting, PR welcome!
Guys,
We have a language with LSP server in langium - likec4. We want embed language in markdown, with syntax highlighting, completions and validation from our server. What would you advice?
-
Like code block, with syntax highlighting, completions and validation:
## Landscape view ```likec4 include element, * -> other ``` Some description -
Inside frontmatter?
--- title: Landscape view likec4: | # Embedded, with syntax highlighting, completions and validation include element, * -> other --- Some description -
Or something like:
--- title: Landscape view --- <likec4> # Embedded, with syntax highlighting, completions and validation include element, * -> other </likec4> Some description
Assuming, this can be applied only to known markdown files (in some folder). Do we need separate lsp server and provide language-service to volar? Or hook with middlewares?
Hi @davydkov
How you implement this depends on what you find easiest, but from my own experience i would prefer option1. You can then scan the document for your tag and pass that to your langium lsp.
This issue is about how you integrate langium with volar, and creating the middleware to simplify it. Without that you would need to figure out how to pass things from volar to langium, and handle the optimizations that is built-inn when you use the lsp-sample that langium creates for you (primarily the documenthandler, so langium caches documents instead of passing the whole document on each edit).
I never got around to fully create a poc, but it could be interesting to hear about your experience/findings as you give it a try :)
//e