Commit graph

21 commits

Author SHA1 Message Date
Tobias Hunger
b718c9c043 tools: Remove progress reporting for file loading
Stop the LSP from reporting progress information on file loading. This
caused problems with VSCode: First it triggered popups in the UI and
secondly it caused problems for the LSP that was asked to process
requests while calling back into the client.

Adapt the online editor and the two VSCode plugins to work with the
updated code.

Note: I did leave in the progress reporting code that can be used to
handle progress initiated by the _client_ side. That is just
notifications which will not block the LSP in any way and we might need
to support that at some point.

I did remove the Middleware code from the client side though that acted
on the progress information.
2023-01-23 19:51:55 +01:00
Tobias Hunger
afdd450d86 vscode: Fix some lints 2023-01-20 18:27:11 +01:00
Tobias Hunger
c79cd21baf LSP: Support highlighting via call-out into javascript
This adds a new "preview-api" feature so that this can be turned on in
WASM without dragging in lots of extra dependencies:-/
2023-01-20 18:27:11 +01:00
Olivier Goffart
94bba83446 LSP: reply to the textDocument/prepareRename request 2022-12-13 16:23:26 +01:00
Tobias Hunger
ea24548ee2 lsp: Report progress on file load in WASM, too 2022-12-05 15:13:14 +01:00
Olivier Goffart
2523a6b74c lsp: Make the LSP async 2022-11-21 09:13:21 +01:00
Olivier Goffart
cbe2d6d631 LSP: add a setting to change the style
... and the include paths
2022-11-13 14:22:27 +01:00
Tobias Hunger
67712d2b46 LSP: Keep current document version around
This will become helpful when actually updating the documents as it can
help to detect races.
2022-11-11 10:34:18 +01:00
Tobias Hunger
268edcf07d LSP: Unify LSP server initialize result
Report the same LSP server `InitializeResult` to all users. This
improves on what was reported from the WASM LSP flavor to its users
before.
2022-11-03 11:41:54 +01:00
Simon Hausmann
1d8c5ac53f Fix serialization of LSP types into wasm
Use a JSON friendly representation that uses JS object instead of ES
maps, as the latter appear to confuse at least the monaco lsp
integration.
2022-10-31 17:34:11 +01:00
Olivier Goffart
db87e9cfe5 LSP: Remove use of deprecated JSValue::{into_serde,from_serde}
These are deprecated and replaced by the funciton from the serde_wasm_bindgen
crate
2022-10-28 11:47:05 +02:00
Simon Hausmann
38749c44be Change signature of wasm lsp file import callback to use a string
This is consistent with the Rust API and the wasm-interpreter.
2022-09-30 13:24:04 +02:00
Simon Hausmann
a8849c1ede Enforce the signature of the file load callback in the wasm build of the interpreter and the lsp 2022-09-30 13:24:04 +02:00
Simon Hausmann
a875c532ba Improve internal default logging behavior with std
Previously, any use of our internal debug_log!() macro would require a
platform backend to be initialized. This was confusing when debugging
something in the (headless) wasm lsp implementation and nothing showed
up on the console.

Now if we can, we will always log. If a platform backend exists, we
route through it, otherwise we can do the fallback ourselves.
2022-09-30 11:13:32 +02:00
Simon Hausmann
45b62b1e57 Fix debug_log! not working inside the wasm build of the lsp server
Without the preview, we don't have a platform backend,
without which debug_log_impl
is a no-op.
2022-09-29 17:50:55 +02:00
Tobias Hunger
521a4001dc Fix some clippy warnings 2022-09-02 17:48:31 +02:00
Olivier Goffart
31502d5918 VSCode web extension: load files from the vscode API
We can't use file system call to load files with wasm, we need to go through the vscode API

Note that this is all async, so i had to prevent re-entry within the compiler using a rentry trick.

I removed the lifetime in the TypeLoader because I thought this was going to be necessary
to get 'static futures. But it turned out not to be necessary. Anyway, I kept it htis way because
it is actually nicer IMHO, even if the CompilationConfiguration is now copied
2022-06-02 16:21:07 +02:00
Olivier Goffart
c969eaf59c vscode web extension: make send_notification work 2022-05-31 17:44:56 +02:00
Olivier Goffart
07ba0f8458 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
2022-05-31 17:44:56 +02:00
Olivier Goffart
9dbe6814f8 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
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