Open georg-schwarz opened 1 year ago
I don't think we can simplify that in the general case because debug adapters depend on the execution runtime of your language. There are two main scenarios:
Both scenarios can't be generalized.
Except... if we'd create a library to ease the implementation of interpreters. Such a library could define a common API that can be generically connected to DAP 🤔
@spoenemann @georg-schwarz In my opinion, any good interpreter built using Langium should actually just generate JavaScript code and source maps. Maybe add some domain functionality using an additional package, but there's really no reason to build your own interpreter for a Langium based language. Packages such as astring
already perform the code generation (including source maps), one only needs to transform a Langium AST to a JS AST.
Thanks for the very fast response! I think I owe you some more context:
We went down the route to implement our own interpreter in the Jayvee project (case 2 mentioned above). First user feedback reported that they'd want a debugger like they are used from by general-purpose languages. Our first research led us to the Debug Adapter Protocol (DAP) with the repo vscode-debugadapter-node you mentioned.
I can imagine this is a common scenario for langium projects (?), thus I hoped you've already made some experiences in that regard and we could tap into your expertise.
Except... if we'd create a library to ease the implementation of interpreters. Such a library could define a common API that can be generically connected to DAP thinking
Obviously, that would be an awesome addition to your langium ecosystem!
Do you have any projects at hands that went down the same road for inspiration? Otherwise, I'd be happy to share our experiences once we successfully went down that rabbit hole ;-)
IMO there are still important use cases for an interpreter:
Do you have any projects at hands that went down the same road for inspiration? Otherwise, I'd be happy to share our experiences once we successfully went down that rabbit hole ;-)
I know of projects connecting an existing runtime/debugger to the DAP, but I haven't seen a debug adapter for a TS/JS interpreter yet.
It would be awesome to simplify creating debuggers for the DSLs created by Langium.
In VS Code this would be supporting the Debug Adapter Protocol (DAP).
Are there any plans in that direction? Or is there already a good example on how to extend Langium-generated VSCode extension with a debug feature?