PhilippeChab / nwscript-ee-language-server

A NWScript Language Server.
https://marketplace.visualstudio.com/items?itemName=PhilippeChab.nwscript-ee-language-server
MIT License
20 stars 7 forks source link

VSCode for the Web #19

Closed WilliamDraco closed 2 years ago

WilliamDraco commented 2 years ago

A straightforward request that I understand might have very non-straightforward solutions.

Would be wonderful to use this excellent extension via vscode.dev, if that's practical given the limitations of the web version.

Much appreciated.

PhilippeChab commented 2 years ago

This is something I've been thinking about since the first days of the project, however since the community is small and most of its members are not programmers per say, I didn't consider it as something mandatory.

I agree it would be nice to have however, and I'll make the appropriate changes to the extension so it can support the vscode web's application when I have some free time.

PhilippeChab commented 2 years ago

So, I have done a bit of reading about this, and unfortunately I won't go forward with it. Here's why:

  1. Extensions in-browser only support a single process to be run at once. One of the advantages of a language extension with a LSP server is to delegate all the heavy, time consuming work to the server while the client can focus on the rendering. We take even more advantage of multi-processing by using all the cores of the user's machine when indexing the project files. With a web extension, we would lose all this, and the experience itself would be degraded. We would also need to do some heavy refactoring in order to use the server as a package for the client to call when features are requested.
  2. Node modules cannot be used in-browser. Again, some heavy refactoring would be needed in order to make the server a usable in-browser package.
  3. Considering the two first points, making the extension browser-compatible would require almost a complete rewrite of its architecture.
  4. Formatting and diagnostics would not be available as we could not access to or simply run at all clang-format executable, nor the nwnsc.
  5. Finally, the extension does work in a Github Codespace environment, with the only limitation of diagnostics, which require a Neverwinter Nights installation that the codespace is lacking - clang-format must be added to the codespace in the pre-build steps for the formatting to work. Codespaces are a lot more powerful than a web application and can be used everywhere.

If anyone else want to embark on the journey of making the extension browser-compatible, they are welcome to do so, but I will not myself. :)

N.B On a side note, I have tried to recreate an artificial Neverwinter Nights installation directory inside the extension resources in order for the extension to be fully usable inside a codespace, without success so far. If anyone has an idea on how to do that, I'm all ears!