Reputation: 77
I'm developing a VSCode extension using LSP (Language Server Protocol) which is activated whenever the user opens a file with extension '.ext'. It has the following structure:
I'm already using the Language Client/Server libraries for VSCode, and the language validation consists on a web server deployed locally on a random free port containing ANTLR4 classes which receive the content of the file the user is modifying. After analysing this content, it sends a response via HTTP to the Language Server part containing the diagnostics about the received code snippet. Then, Server sends the adapted diagnostics to Client, so they can be used by VSCode to inform the user about the errors.
The extension works fine, but I have to run the language validation server manually whenever I want to use the extension (which is writen in Node.js). Is there a way to automatically start that node server whenever the extension is activated?
Thanks in advance.
Upvotes: 1
Views: 117
Reputation: 659
The idea of starting an http server on another machine using a VS Code extension sounds strange to me, I think you can use the ANTLR-generated parser directly in your language server. If the parser is not generated in the same language as the server's, you can just re-generate it from the grammar.
Upvotes: 1