Skip to main content

[!CAUTION] This Project is still in an early stage.
Only the format capability is production ready.
The rest is experimental.

Fichu 🦀

⚡A blazingly fast language server for SPARQL, written in Rust 🦀.

Getting Started

Installation

Fichu is available on crate.io:

cargo install fichu

And on PyPi:

pipx install fichu

You can also build it from source:

git clone https://github.com/IoannisNezis/sparql-language-server.git
cd sparql-language-server
cargo build --release --bin fichu

Usage

To run Fichu as formatter run:

fichu format <PATH>

To run Fichu as lanugage server run:

fichu server

This will create a language server listening on stdio.

Connect to Neovim

After you installed the language server, add this to your init.lua:

vim.api.nvim_create_autocmd({ 'FileType' }, {
  desc = 'Connect to sparql-language-server',
  pattern = { 'sparql' },
  callback = function()
    vim.lsp.start {
      name = 'fichu',
      cmd = { 'fichu', 'server' },
      root_dir = vim.fn.getcwd(),
      on_attach = function(client, bufnr)
        vim.keymap.set('n', '<leader>f', vim.lsp.buf.format, { buffer = bufnr, desc = 'LSP: ' .. '[F]ormat' })
      end,
    }
  end,
})

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

Currently provides a few basic diagnostics for syntax errors and simple issues in SPARQL queries. Further enhancements are planned to cover a broader range of semantic and logic-related diagnostics.

Currently provided diagnostics:

  • unused namespace (warning): A declared namespace is not used
  • undefined namespace (error): A used namespace is not declared

Planed diagnostics:

  • path compresion possible (info): A declared namespace is not used

Completion

Status: Rudimentary

Basic auto-completion for SPARQL keywords and variables. Currently not context aware.
Future improvements will expand suggestions to include functions, predicates, and custom completions based on query context.

Code Actions

Status: Planed

Future support for code actions, such as quick fixes and refactoring suggestions, to improve productivity and code quality in SPARQL development.

Planed code actions:

  • Consolidate property paths
  • Refactor iris into namespaces
  • Sort Prefixes

Configuration

Fichu can be configured through a fichu.toml or fichu.yml file.

Here is the full default configuration

[format]
align_predicates = false
align_prefixes = false
separate_prolouge = true
capitalize_keywords = true
insert_spaces = true
tab_size = 2
where_new_line = true

use in web

If you want to connect from a web-based-editor, you can use this package as well.
For this purpouse this can be compiled to wasm and is availible on npm:

npm i @ioannisnezis/sparql-language-server

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...

Demo

In the mean time, check out the demo.

Metadata

Release files for fichu 0.1.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fichu 0.1.16
File Size Uploaded Provenance
fichu-0.1.16.tar.gz 54.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fichu 0.1.16
File Interpreter ABI Platform
fichu-0.1.16-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details

Total release size: 2.2 MB

Release files / fichu-0.1.16.tar.gz

Download URL fichu-0.1.16.tar.gz
Size 54.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f4e2047dc0d2d068def391e1e286554dbd9fb460f80f1bb4173fd1c0e96de8b0
BLAKE2b-256 checksum
How to use checksums
e54794a509a59b3134a03f192935147e7ea00c1f79c324a57392c9f7f990e4d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.1

Release files / fichu-0.1.16-py3-none-manylinux_2_34_x86_64.whl

Download URL fichu-0.1.16-py3-none-manylinux_2_34_x86_64.whl
Size 2.1 MB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
ae433520f55f0fc419c76270c6319723031bad254adbf2e7d65c16d1aeb6bef2
BLAKE2b-256 checksum
How to use checksums
e0c345a7979407c53f36dadc68c60aaec340f5c29ebcaa5d24c99c296e39a71b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.7.1

Security for fichu 0.1.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page