A Language Server Protocol (LSP) implementation for SurrealDB's query language, SurrealQL.
Work in Progress!
SurrealQL LSP is built with Rust and leverages several powerful libraries:
Development is ongoing, so installation guides are currently limited to Neovim or Visual Studio Code. Either way, clone and change directories to the root of the repository.
Open Visual Studio Code in the root of the repository.
Ensure that you have installed the required node modules:
cd editors/code && npm install && cd ../..
Once installed, you can launch the extension by pressing F5
. This will open a new
instance of Visual Studio Code. In the new instance, navigate to the examples/test.surql
file. Start typing SurrealQL, you should see completions!
Add the following Lua script to your Neovim configuration:
local M = {}
local find_rust_bin = function()
return '<path-to-repo>/surrealql-lsp/target/debug/surrealql-lsp-server'
end
M.start = function()
vim.lsp.set_log_level 'debug'
require('vim.lsp.log').set_format_func(vim.inspect)
local client = vim.lsp.start {
name = 'surrealql-lsp-server',
cmd = { find_rust_bin() },
}
if not client then
vim.notify('Failed to start surrealql-lsp-server', vim.log.levels.ERROR)
return
end
vim.lsp.buf_attach_client(0, client)
end
local group = vim.api.nvim_create_namespace 'surrealql-lsp-server'
M.setup = function()
vim.api.nvim_clear_autocmds { group = group }
vim.api.nvim_create_autocmd('FileType', {
group = group,
pattern = 'surql',
callback = M.start,
})
end
return M
Inside the root of the repository, run:
cargo build
Navigate to your test.surql
file and run :LspInfo
in Neovim to ensure the LSP is attached.
Utilises tree-sitter for efficient incremental parsing.
Provides code completion support to streamline your development workflow - ongoing!
Hover over SurrealQL keyworks for documentation - ongoing!
We welcome contributions! If you find this project interesting and want to help, please consider contributing.