Skip to main content

A formatter for SPARQL queries

Project description

Fichu

A blazingly fast formatter and language server for SPARQL, written in Rust :crab:.

Getting Started

Installation

Fichu is availible on PyPi:

pipx install fichu

Or on crate.io:

cargo 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

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fichu-0.1.10.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

fichu-0.1.10-py3-none-manylinux_2_34_x86_64.whl (2.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.34+ x86-64

File details

Details for the file fichu-0.1.10.tar.gz.

File metadata

  • Download URL: fichu-0.1.10.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.1

File hashes

Hashes for fichu-0.1.10.tar.gz
Algorithm Hash digest
SHA256 7ccb3202e93bdfcefef2e1bcb83c28e77991354527bc8bc9dc25b57d381ffdd0
MD5 956b05bda06b09de1221f884b0212fdb
BLAKE2b-256 adfb60005bc95d5d4b92d9f6e257eb28351f39a342a9facfaf2f588325336997

See more details on using hashes here.

File details

Details for the file fichu-0.1.10-py3-none-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fichu-0.1.10-py3-none-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e8f0d4747d53f6b3be2a363d302a8796778dad324b760925305311ef60063cea
MD5 6301bd2d96d36b0f1aee7c91f0e3823e
BLAKE2b-256 4c1837bf8763f4cca78fa41204e6199385e2034bab53c0f4934c5188899455e5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page