Replies: 1 comment 15 replies
-
Hey @ejfasting,
Yes, please don't do that, it will lead down a rabbit hole you don't want to go down. It doesn't really have to do with Langium, but rather the general approach of dealing with disjointed super languages. You probably have seen vscode's documentation on embedded languages. I would recommend something similar as they do in the Request Forwarding section. The main steps to take would be:
An alternative to the request information transformation would be whitespace padding. I.e. replace all data before the code block to whitespace and remove all data after the code block. That way, range/position information stays accurate across document blocks. Basically, it all comes down to writing a lot of language client middleware, this isn't necessarily specific for Langium. Note that the language services way of doing it could also be adapted to Langium almost 1:1 as it is outlined in the documentation. But it assumes complete control over all languages that you want include (including the top language). Since you want to include HTML, CSS and JS, I don't think this will work well unless someone has those language services available for consumption (which might be possible). |
Beta Was this translation helpful? Give feedback.
-
Hello!
I'm looking into langium as a possible solution to create a new language support for vscode and monaco editor.
In my scenario i need to create a webextension (since it must be useable from monaco) and it also requires some embedded languages which is a mix of plaintext, html, css, javascript and my custom language.
Defining my custom language looks doable, but im a little unsure what is within the capabilities of langium and what is not when it comes to embedded languages (?)
From reading the documentation and other threads here on the discussion-board it seems like langium doesnt really have anything to do with embedding languages, it is strictly for creating support for a language?
I was wondering if you could somehow create a 'top level language that also contains all embedded ones', but i might be trying to screw a screw with a hammer? I also need to leverage existing LSPs for the other languages, and i highly doubt that is something langium can help with (?)
The question is kinda open, as i want input on what langium can be used for to support my scenario, and any input/suggestion are appreciated :)
//eivind
Beta Was this translation helpful? Give feedback.
All reactions