prql icon indicating copy to clipboard operation
prql copied to clipboard

Investigate PRQL for Language Server

Open qharlie opened this issue 2 years ago • 3 comments

Never looked at this so no idea what it might take

https://microsoft.github.io/language-server-protocol/

qharlie avatar Apr 07 '22 20:04 qharlie

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,
}

kiibo382 avatar Apr 08 '22 23:04 kiibo382

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

kiibo382 avatar Apr 08 '22 23:04 kiibo382

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.

max-sixty avatar Apr 09 '22 00:04 max-sixty