@aws/lsp-partiql
v0.0.4
Published
PartiQL language server
Downloads
8
Maintainers
Keywords
Readme
PartiQL LSP server
LSP server for the PartiQL language. This server offers diagnostics for PartiQL files by parsing the file using the Rust parser maintained by the PartiQL team.
This parser is compiled to a WebAssembly binary using the bindings maintained by the PartiQL team in the PartiQL playground package. This binary is further encoded as a base64 string in a Javascript file to make it easy to be bundled together with the other assets of the server.
Updating the binary
Updating the binary requires the Docker CLI to be in your PATH
To update the binary used by the server, run npm run update-parser-binary
. This will, inside a Docker container, pull the PartiQL playground repository from GitHub and run the build
command to create a new binary. It is then encoded into base64 in a Typescript file and copied to the src
folder. Running npm run build
will then transpile the binary file to Javascript and place it in the lib
folder.
To update the binary used in package web-tree-sitter
, run npm run update-treesitter-wasm
. This update is forced to make everytime upgrading the version of web-tree-sitter
. This will compile the tree-sitter.wasm
file inside the package into a base64 string in a TypeScript file to the src/tree-sitter-parser
folder as tree-sitter-inline.ts
.
Updating the ANTLR lexer and parser
The ANTLR lexer and parser grammars are defined in src/antlr-grammar
, the files in src/antlr-generated
are automatically generated from the grammar files. To
update these files, run npm run update-antlr
. The current grammar files can be found at https://github.com/partiql/partiql-lang-kotlin/tree/main/partiql-parser/src/main/antlr.
Tests
Tests for this package are run using Jest, to run the tests in this package run -npm run test
.
Potential improvements
This package currently has a couple of potential points-of-improvement:
- In the bindings for the parser WASM binary, there is a code path which imports the
partiql_playground_bg.wasm
file. We don't use this file and code path at runtime due to the inlining of the WASM binary. When doing import checks however, Webpack fails building because it cannot find this binary. To work around this, we include a no-op file with the expected name. - In the tests for the language service, there are a couple of untested happy paths. Input couldn't be found to trigger these happy paths.