⚡Qlue-ls (pronounced "clueless") is a blazingly fast language server for SPARQL, written in Rust 🦀.
[!CAUTION] This Project is still in an early stage.
Only the format capability is production ready.
The rest is experimental.
🚀 Getting Started
📦 Installation
Qlue-ls is available on crate.io:
cargo install --bin qlue-ls qlue-ls
And on PyPI:
pipx install qlue-ls
You can also build it from source:
git clone https://github.com/IoannisNezis/Qlue-ls.git
cd Qlue-ls
cargo build --release --bin qlue-ls
CLI Usage
To run Qlue-ls as formatter run:
qlue-ls format <PATH>
To run Qlue-ls as language server run:
qlue-ls server
This will create a language server listening on stdio.
with Neovim
After you installed the language server, add this to your init.lua:
vim..
Open a .rq file and check that the buffer is attached to th server:
:checkhealth lsp
Configure keymaps in on_attach function.
🚀 Capabilities
📐 Formatting
Status: Full support
Formats SPARQL queries to ensure consistent and readable syntax. Customizable options to align with preferred query styles are also implemented.
🩺 Diagnostics
Status: Partial support
** provided diagnostics**:
| Type | Name | Description |
|---|---|---|
| ❌ error | undefined prefix | a used prefix is not declared |
| ⚠️ warning | unused prefix | a declared prefix is not used |
| ℹ️ info | uncompacted uri | a raw uncompacted uri is used |
✨ Completion
Status: Partial support
I split auto-completion into 3 stages:
- Static (Keywords, constructs, ...)
- Dynamic offline (local defined variables)
- Dynamic online (with data from a knowledge-graph)
The implementation is in Stage 2.8.
Dynamic online completion works!
At the moment the context is limited to the Tripple the completion is requested from. Next step is to introduce full context sensitivity.
🛠️ Code Actions
Status: Partial support
| name | description | diagnostic |
|---|---|---|
| shorten uri | shorten uri into compacted form | uncompacted uri |
| declare prefix | declares undeclared prefix (if known) | undeclared prefix |
| shorten all uri's | shorten all uri's into compacted form | |
| add to result | add variable to selected result | |
| filter variable | add filter for this variable |
⚙️ Configuration
Qlue-ls can be configured through a qlue-ls.toml or qlue-ls.yml file.
Here is the full default configuration
[]
= true
= true
= false
= true
= true
= 10
= true
= true
[]
= 5000
= 42
🌐 use in web
If you want to connect from a web-based-editor, you can use this package as well.
For this purpose this can be compiled to wasm and is available on npm:
npm i qlue-ls
You will have to wrap this in a Web Worker and provide a language server client. There will be more documentation on this in the future...
Until then you can check out the demo in ./editor/
🏗 Development Setup
Here is a quick guide to set this project up for development.
Requirements
- rust >= 1.83.0
- wasm-pack >= 0.13.1
- node & npm >= 22.14.0 & >= 11.3.0
- [Optional] just
- [Optional] watchexec
Initial Setup
You will only have to do this once.
install node dependencies
build wasm & bindings
If you have just installed:
If you have make installed:
If you don't have just or make installed:
Install just
link against local package
Run application
Now the webapp should be running, open the browser on localhost:5173.
Automatically rebuild on change
When developping the cycle is:
- Change the code
- Compile to wasm (or run tests)
- Evaluate
To avoid having to run a command each time to Compile I strongly recommend setting up a auto runner like watchexec.
or just:
have fun!
🙏 Special Thanks
- TJ DeVries for the inspiration and great tutorials
- Chris Biscardi for teaching me Rust
- GordianDziwis for providing a sparql-tree-sitter grammar