fichu


Namefichu JSON
Version 0.1.16 PyPI version JSON
download
home_pageNone
SummaryA formatter for SPARQL queries
upload_time2024-12-16 00:16:23
maintainerNone
docs_urlNone
authorIoannis Nezis <ioannis@nezis.de>
requires_python>=3.8
licenseMIT
keywords sparql formatter lsp wasm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            > [!CAUTION]
> This Project is still in an early stage.  
> Only the format capability is production ready.  
> The rest is experimental.

<h1 align="center">
  Fichu 🦀
</h1>

⚡A blazingly fast [language server](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification) for [SPARQL](https://de.wikipedia.org/wiki/SPARQL), written in Rust 🦀.

# Getting Started

## Installation

Fichu is available on [crate.io](https://crates.io/crates/fichu):

```shell
cargo install fichu
```

And on [PyPi](https://pypi.org/project/fichu/):

```shell
pipx install fichu
```

You can also build it from source:

```shell
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:

```shell
fichu format <PATH>
```

To run Fichu as **lanugage server** run:

```shell
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`:

```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
```toml
[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](https://www.npmjs.com/package/@ioannisnezis/sparql-language-server):


```shell
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](https://sparql.nezis.de).


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fichu",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "SPARQL, formatter, lsp, wasm",
    "author": "Ioannis Nezis <ioannis@nezis.de>",
    "author_email": "Ioannis Nezis <ioannis@nezis.de>",
    "download_url": "https://files.pythonhosted.org/packages/e5/47/94a509a59b3134a03f192935147e7ea00c1f79c324a57392c9f7f990e4d1/fichu-0.1.16.tar.gz",
    "platform": null,
    "description": "> [!CAUTION]\n> This Project is still in an early stage.  \n> Only the format capability is production ready.  \n> The rest is experimental.\n\n<h1 align=\"center\">\n  Fichu \ud83e\udd80\n</h1>\n\n\u26a1A blazingly fast [language server](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification) for [SPARQL](https://de.wikipedia.org/wiki/SPARQL), written in Rust \ud83e\udd80.\n\n# Getting Started\n\n## Installation\n\nFichu is available on [crate.io](https://crates.io/crates/fichu):\n\n```shell\ncargo install fichu\n```\n\nAnd on [PyPi](https://pypi.org/project/fichu/):\n\n```shell\npipx install fichu\n```\n\nYou can also build it from source:\n\n```shell\ngit clone https://github.com/IoannisNezis/sparql-language-server.git\ncd sparql-language-server\ncargo build --release --bin fichu\n```\n\n## Usage\n\nTo run Fichu as **formatter** run:\n\n```shell\nfichu format <PATH>\n```\n\nTo run Fichu as **lanugage server** run:\n\n```shell\nfichu server\n```\n\nThis will create a language server listening on stdio.\n\n## Connect to Neovim\n\nAfter you installed the language server, add this to your `init.lua`:\n\n```lua\nvim.api.nvim_create_autocmd({ 'FileType' }, {\n  desc = 'Connect to sparql-language-server',\n  pattern = { 'sparql' },\n  callback = function()\n    vim.lsp.start {\n      name = 'fichu',\n      cmd = { 'fichu', 'server' },\n      root_dir = vim.fn.getcwd(),\n      on_attach = function(client, bufnr)\n        vim.keymap.set('n', '<leader>f', vim.lsp.buf.format, { buffer = bufnr, desc = 'LSP: ' .. '[F]ormat' })\n      end,\n    }\n  end,\n})\n```\n\nOpen a `.rq` file and check that the buffer is attached to th server:\n\n```\n:checkhealth lsp\n```\n\nConfigure keymaps in `on_attach` function.\n\n# Capabilities\n\n## Formatting\n\n**Status**: Full support\n\nFormats SPARQL queries to ensure consistent and readable syntax.\nCustomizable options to align with preferred query styles are also implemented.\n\n## Diagnostics\n\n**Status**: Partial support\n\nCurrently provides a few basic diagnostics for syntax errors and simple issues in SPARQL queries.\nFurther enhancements are planned to cover a broader range of semantic and logic-related diagnostics.\n\n**Currently provided diagnostics**:\n\n- unused namespace (warning): A declared namespace is not used\n- undefined namespace (error): A used namespace is not declared\n\n**Planed diagnostics**:\n\n- path compresion possible (info): A declared namespace is not used\n\n## Completion\n\n**Status**: Rudimentary\n\nBasic auto-completion for SPARQL keywords and variables. Currently not context aware.  \nFuture improvements will expand suggestions to include functions, predicates, and custom completions based on query context.\n\n## Code Actions\n\n**Status**: Planed\n\nFuture support for code actions, such as quick fixes and refactoring suggestions, to improve productivity and code quality in SPARQL development.\n\n**Planed code actions**:\n\n- Consolidate property paths\n- Refactor iris into namespaces\n- Sort Prefixes\n\n# Configuration\n\nFichu can be configured through a `fichu.toml` or `fichu.yml` file.\n\nHere is the full default configuration\n```toml\n[format]\nalign_predicates = false\nalign_prefixes = false\nseparate_prolouge = true\ncapitalize_keywords = true\ninsert_spaces = true\ntab_size = 2\nwhere_new_line = true\n```\n\n# use in web\n\nIf you want to connect from a web-based-editor, you can use this package as well.  \nFor this purpouse this can be compiled to wasm and is availible on [npm](https://www.npmjs.com/package/@ioannisnezis/sparql-language-server):\n\n\n```shell\nnpm i @ioannisnezis/sparql-language-server\n```\n\nYou will have to wrap this in a Web Worker and provide a language server client.\nThere will be more documentation on this in the future...\n\n## Demo\n\nIn the mean time, check out the [demo](https://sparql.nezis.de).\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A formatter for SPARQL queries",
    "version": "0.1.16",
    "project_urls": {
        "Source Code": "https://github.com/IoannisNezis/sparql-language-server"
    },
    "split_keywords": [
        "sparql",
        " formatter",
        " lsp",
        " wasm"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e0c345a7979407c53f36dadc68c60aaec340f5c29ebcaa5d24c99c296e39a71b",
                "md5": "249951f77f6e079faac325bcf642a701",
                "sha256": "ae433520f55f0fc419c76270c6319723031bad254adbf2e7d65c16d1aeb6bef2"
            },
            "downloads": -1,
            "filename": "fichu-0.1.16-py3-none-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "249951f77f6e079faac325bcf642a701",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 2123831,
            "upload_time": "2024-12-16T00:16:19",
            "upload_time_iso_8601": "2024-12-16T00:16:19.727613Z",
            "url": "https://files.pythonhosted.org/packages/e0/c3/45a7979407c53f36dadc68c60aaec340f5c29ebcaa5d24c99c296e39a71b/fichu-0.1.16-py3-none-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e54794a509a59b3134a03f192935147e7ea00c1f79c324a57392c9f7f990e4d1",
                "md5": "8adfd11ee989be4782eb625cf8c518e5",
                "sha256": "f4e2047dc0d2d068def391e1e286554dbd9fb460f80f1bb4173fd1c0e96de8b0"
            },
            "downloads": -1,
            "filename": "fichu-0.1.16.tar.gz",
            "has_sig": false,
            "md5_digest": "8adfd11ee989be4782eb625cf8c518e5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 54323,
            "upload_time": "2024-12-16T00:16:23",
            "upload_time_iso_8601": "2024-12-16T00:16:23.685524Z",
            "url": "https://files.pythonhosted.org/packages/e5/47/94a509a59b3134a03f192935147e7ea00c1f79c324a57392c9f7f990e4d1/fichu-0.1.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-16 00:16:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "IoannisNezis",
    "github_project": "sparql-language-server",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fichu"
}
        
Elapsed time: 0.40353s