Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode web extension #1300

Merged
merged 9 commits into from May 31, 2022
Merged

vscode web extension #1300

merged 9 commits into from May 31, 2022

Commits on May 31, 2022

  1. 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   ../..
    ogoffart committed May 31, 2022
    Configuration menu
    Copy the full SHA
    3cfa22b View commit details
    Browse the repository at this point in the history
  2. 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.
    tronical authored and ogoffart committed May 31, 2022
    Configuration menu
    Copy the full SHA
    2f7a583 View commit details
    Browse the repository at this point in the history
  3. LSP: Some progress on the vscode browser extension

    we need to use commonjs for the extension
    
    If we start the client before the server has loaded the wasm, we don't
    listen yet to the init message, so make sure not to start the client
    before we sent the "OK" message back.
    
    But it's still not working, the wasm code is called, but the parameter are
    not properly passed
    ogoffart committed May 31, 2022
    Configuration menu
    Copy the full SHA
    c42c9f3 View commit details
    Browse the repository at this point in the history
  4. vscode: Some progress on the web extension

    Now it calls in the wasm properly.
    But i get borrowmut error because the wasm re-enter from send_notification into the request
    ogoffart committed May 31, 2022
    Configuration menu
    Copy the full SHA
    ecddb52 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e1832c5 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    7cfc911 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    47a1132 View commit details
    Browse the repository at this point in the history
  8. Prospective fix for vsce package build

    Build regular and web extension in one go
    tronical committed May 31, 2022
    Configuration menu
    Copy the full SHA
    7717d82 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    c59d5fa View commit details
    Browse the repository at this point in the history