https://github.com/ce11an/surrealql-lsp
A Language Server Protocol (LSP) implementation for SurrealDB's query language, SurrealQL.
https://github.com/ce11an/surrealql-lsp
lsp lsp-server surrealdb surrealql
Last synced: about 2 months ago
JSON representation
A Language Server Protocol (LSP) implementation for SurrealDB's query language, SurrealQL.
- Host: GitHub
- URL: https://github.com/ce11an/surrealql-lsp
- Owner: Ce11an
- License: apache-2.0
- Created: 2024-04-09T20:28:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-12T09:47:28.000Z (8 months ago)
- Last Synced: 2025-04-02T17:21:35.567Z (6 months ago)
- Topics: lsp, lsp-server, surrealdb, surrealql
- Language: Rust
- Homepage:
- Size: 284 KB
- Stars: 16
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# SurrealQL LSP
A Language Server Protocol (LSP) implementation for SurrealDB's query language, SurrealQL.
__Work in Progress!__
## About
SurrealQL LSP is built with Rust and leverages several powerful libraries:
- [tower-lsp](https://github.com/ebkalderon/tower-lsp)
- [lsp-textdocument](https://github.com/GiveMe-A-Name/lsp-textdocument)
- [tree-sitter-surrealql](https://github.com/Ce11an/tree-sitter-surrealql)## Installation
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.### Visual Studio Code
Open Visual Studio Code in the root of the repository.Ensure that you have installed the required node modules:
```posh
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!### Neovim Setup
Add the following Lua script to your Neovim configuration:```lua
local M = {}local find_rust_bin = function()
return '/surrealql-lsp/target/debug/surrealql-lsp-server'
endM.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
endvim.lsp.buf_attach_client(0, client)
endlocal 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,
})
endreturn M
```Inside the root of the repository, run:
```sh
cargo build
```Navigate to your `test.surql` file and run `:LspInfo` in Neovim to ensure the LSP is attached.
## Features
### Incremental Parsing
Utilises [tree-sitter](https://github.com/tree-sitter/tree-sitter) for efficient incremental parsing.### Code Completion
Provides code completion support to streamline your development workflow - ongoing!
### Hover
Hover over SurrealQL keyworks for documentation - ongoing!
## Contributions
We welcome contributions! If you find this project interesting and want to help, please consider contributing.