prql
prql copied to clipboard
Investigate PRQL for Language Server
Never looked at this so no idea what it might take
https://microsoft.github.io/language-server-protocol/
First, the token must have location information. The following structure is recommended.
/// For example, `from` equals
/// ```
/// Token {
/// body: "from",
/// location_l {
/// row: 0,
/// column: 0,
/// offset: 0
/// },
/// location_r {
/// row: 0,
/// column: 4,
/// offset: 4,
/// }
/// }
/// ```
struct Token {
body: String,
location_l: Location,
location_r: Location,
}
struct Location {
row: usize,
column: usize,
offset: usize,
}
The following will be helpful.
- https://github.com/microsoft/vscode-extension-samples/tree/main/lsp-sample
- https://github.com/rust-analyzer/lsp-server/tree/master/examples
- https://code.visualstudio.com/api/language-extensions/language-server-extension-guide
- https://github.com/rust-analyzer/rust-analyzer
This was great, too: https://www.osohq.com/post/building-vs-code-extension-with-rust-wasm-typescript
It seems like they took their own approach rather than building on something like https://github.com/ebkalderon/tower-lsp. I'm not sure whether writing something for Monaco / Monarch in the browser has different sync / async constraints than only building for a local LSP.