Closed tenko closed 2 years ago
I'm not using VSCode; just had a look at how they do syntax highlighting; apparently they expect a description in JSON format, see https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide and https://macromates.com/manual/en/language_grammars. There seem to be different ways how to implement language support though; another way seem to be to implement a language server using a JSON based protocol (https://code.visualstudio.com/api/language-extensions/language-server-extension-guide); both ways will cause additional work. My parser produces an AST which is suited for use in an IDE, but it's C++ using Qt; when I'm ready with the QtNetwork stuff in LeanQt it should be possible to implement such a server; but it's currently not on my agenda; syntax highlighting, code completion etc. is not the whole story; eventually you certainly also need to run the debugger, so yet another protocol which has to be implemented.
The language server does not need to be implemented as this is done in JavaScript by utilizing the API for this part in VSCode. The JavaScript code simply calls the ObxMC binary with parser a temporary .obx code file and the compiler then spews out some JSON data which can be read in to the JavaScript side and further processed to create the language server reply.
An example of this can be found: vscode cli compiler
I was thinking this should be fairly low impact to support in the ObxMC compiler. The above example language server seems easy enough to simply reuse most of.
Ok, I see; but the OBXMC is not suited to do this; it would need another generator which would create a JSON file compatible with the format required by VSCode; seems like quite some work given that it is also supposed to work with wrong code, and the implementor needs pretty good knowledge of VSCode, the highlighting protocol and the implicit and explicit expectations to the AST and error reporting; and if I understand it right OBXMC would then essentially be called potentially for every edit done in VSCode, which looks quite expensive.
Can you make a list what the most important features are, which VSCode has and the Oberon IDE is missing?
Fair enough. I was hoping this was possible to hack together easily, as I already have started using VSCode due to the plugins for PostgreSQL, FreePascal etc. Great solutions, even if the whole system is huge bloat with Electron in the background. Not any particular things missing from the IDE. We can close this.
I was looking into supporting Oberon+ in VSCode. Turns out there was a Pascal language file which would be reused and this is now working nicely for syntax highlighting.
I was thinking it could be possible to support the more advanced language integration present in VSCode, similar to what is available for Python, C# etc.
I believe this functionality is already present in the Qt IDE you have created.
If the compiler outputs JSON data on syntax check, dot completion, symbol definition, symbol type etc the integration with VSCode is down to modifying the code examples (TypeScript) existing online to call out the ObxMC binary in order to feed information into the language server.
Also probably other editors / IDE could be supported in a similar way.
Could you be willing to look into this possibility?