Commit graph

2 commits

Author SHA1 Message Date
Simon Hausmann
1437648df1 WIP: bundle the lsp wasm inside browserServerMain.js
* Use wasm-pack's web mode to create a .wasm file and an ESM module for the
  glue code
* Import the .wasm file directly in browserServerMain.ts
* And process it all with esbuild, which succeeds in seeing the .wasm import in
  browserServerMain.ts and then bundles it inline.
2022-05-31 17:44:56 +02:00
Olivier Goffart
8f03e2cff1 WIP: make the vscode extension work as web extension
This refactor the LSP to be possible to compile for wasm.
When using wasm we can't use the lsp-server crate because that one use the
stdin/stdout to communicate.
Instead, we need will do the communication in TypeScript using the vscode
language server protocol library, and serialize the types to wasm. Fortunately
that's easy because the lsp-types crate contains all the serialized types.

This also "duplicate" the extension as a web extension that do not use process
to start the LSP, but use a web worker. Some of the extension code could
be refactored to avoid some duplication (like the status bar handling and such).
And add a "browser" entry point in the package.json

Finally, add a browserServerMain.ts entry point for our worker, it will try to load
the wasm code.

Currently this doesn't wirk: the browserServerMain.ts can't load the wasm.

Also todo is to write the code so that the wasm code can send the response and
notifications.

To debug, I type these commands in editor/vscode directory

    npm run compile-web
    code --extensionDevelopmentKind=web --extensionDevelopmentPath=$PWD   ../..
2022-05-31 17:44:56 +02:00