[WIP] Implement LSP
Closes #3
Super WIP, but thought it might be good to have some initial feedback on the approach.
For now, https://github.com/bytecodealliance/wasm-tools is used, but I'm thinking about adding support for https://github.com/bytecodealliance/cargo-component since currently it has its own logic for resolving wit packages, which seems to have some advantages.
To test it out, have a recent version of wasm-tools installed, run npm install, npm start & reload the vscode window.
Preview
Diagnostics
Hover
TODO
- [ ] lint correctly when inside deps folder
- [ ] allow configuring problem matcher & pattern
- [ ] run wit-deps when appropriate
- [ ] clean up package.json scripts
- [ ] clean up changes as much as possible
Thanks @eduardomourar - I'll get started on the tests
Some updates: Ultimately I decided to fork wit-parser so I could make some items public for more advanced features than linting such as semantic tokens, contextual hovering, etc.
This code would more appropriately live in the wasm-tools repository alongside wit-parser.
My current thinking is for this to become a binary crate "wit-lsp" in wasm-tools with some of the logic pushed to the wit-parser crate under an "lsp" feature flag.
This isn't blocking as I can keep using the fork for now, but I think moving to that approach would make the LSP more robust and easier to keep up-to-date. Also, keeping it separate from the VSCode extension would make it easier to port for other editors.
I can make that move if it makes sense.
@cardoso , let's keep the LSP code here for now in order to iterate more quickly (specially because I don't have permissions to the wasm-tools repository). To simplify that migration later on, we need to move all LSP related files to a folder called ./lsp.
This pull request has been marked as stale because it has been open for 60 days with no activity. It will be closed in 10 days unless there is further activity. To keep it open, add a comment or remove the stale label.