qlue-ls


Nameqlue-ls JSON
Version 0.2.2 PyPI version JSON
download
home_pageNone
SummaryA formatter for SPARQL queries
upload_time2025-01-11 23:35:53
maintainerNone
docs_urlNone
authorIoannis Nezis <ioannis@nezis.de>
requires_python>=3.8
licenseNone
keywords sparql rdf lsp lsp-server wasm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">
  🦀 Qlue-ls 🦀
</h1>

⚡Qlue-ls (pronounced "clueless") is 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 🦀.

> [!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](https://crates.io/crates/qlue-ls):

```shell
cargo install qlue-ls
```

And on [PyPi](https://pypi.org/project/qlue-ls/):

```shell
pipx install qlue-ls
```

You can also build it from source:

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

```shell
qlue-ls format <PATH>
```

To run Qlue-ls as **language server** run:

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

```lua
vim.api.nvim_create_autocmd({ 'FileType' }, {
  desc = 'Connect to Qlue-ls',
  pattern = { 'sparql' },
  callback = function()
    vim.lsp.start {
      name = 'qlue-ls',
      cmd = { 'qlue-ls', '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

** 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:

1. Static (Keywords, constructs, ...)
2. Dynamic offline (local defined variables)
3. Dynamic online (with data from a knowledge-graph)

The implementation is in Stage 1.5.
Static completion is done, dynamic offline completion is in development.

## 🛠️ 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 |                   |

# ⚙️  Configuration

Qlue-ls can be configured through a `qlue-ls.toml` or `qlue-ls.yml` file.

Here is the full default configuration
```toml
[format]
align_predicates = true
align_prefixes = false
separate_prolouge = false
capitalize_keywords = true
insert_spaces = true
tab_size = 2
where_new_line = false
```

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


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

# 🙏 Special Thanks

* [TJ DeVries](https://github.com/tjdevries) for the inspiration and great tutorials
* [Chris Biscardi](https://github.com/christopherbiscardi) for teaching me Rust
* [GordianDziwis](https://github.com/GordianDziwis) for providing a sparql-tree-sitter grammar



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "qlue-ls",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "SPARQL, rdf, lsp, lsp-server, wasm",
    "author": "Ioannis Nezis <ioannis@nezis.de>",
    "author_email": "Ioannis Nezis <ioannis@nezis.de>",
    "download_url": "https://files.pythonhosted.org/packages/f5/6c/7ee27893051b1865e74284c6a54efc63c121e697cc3d313bff9dcd301e6f/qlue_ls-0.2.2.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">\n  \ud83e\udd80 Qlue-ls \ud83e\udd80\n</h1>\n\n\u26a1Qlue-ls (pronounced \"clueless\") is 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 \ud83e\udd80.\n\n> [!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# \ud83d\ude80 Getting Started\n\n## \ud83d\udce6 Installation\n\nQlue-ls is available on [crate.io](https://crates.io/crates/qlue-ls):\n\n```shell\ncargo install qlue-ls\n```\n\nAnd on [PyPi](https://pypi.org/project/qlue-ls/):\n\n```shell\npipx install qlue-ls\n```\n\nYou can also build it from source:\n\n```shell\ngit clone https://github.com/IoannisNezis/Qlue-ls.git\ncd Qlue-ls\ncargo build --release --bin qlue-ls\n```\n\n## CLI Usage\n\nTo run Qlue-ls as **formatter** run:\n\n```shell\nqlue-ls format <PATH>\n```\n\nTo run Qlue-ls as **language server** run:\n\n```shell\nqlue-ls server\n```\n\nThis will create a language server listening on stdio.\n\n## with 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 Qlue-ls',\n  pattern = { 'sparql' },\n  callback = function()\n    vim.lsp.start {\n      name = 'qlue-ls',\n      cmd = { 'qlue-ls', '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# \ud83d\ude80 Capabilities\n\n## \ud83d\udcd0 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## \ud83e\ude7a Diagnostics\n\n**Status**: Partial support\n\n** provided diagnostics**:\n\n| Type        | Name             | Description                   |\n|:------------|:-----------------|:------------------------------|\n| \u274c error     | undefined prefix | a used prefix is not declared |\n| \u26a0\ufe0f  warning | unused prefix    | a declared prefix is not used |\n| \u2139\ufe0f  info    | uncompacted uri  | a raw uncompacted uri is used |\n\n## \u2728 Completion\n\n**Status**: Partial support\n\nI split auto-completion into 3 stages:\n\n1. Static (Keywords, constructs, ...)\n2. Dynamic offline (local defined variables)\n3. Dynamic online (with data from a knowledge-graph)\n\nThe implementation is in Stage 1.5.\nStatic completion is done, dynamic offline completion is in development.\n\n## \ud83d\udee0\ufe0f Code Actions\n\n**Status**: Partial support\n\n| name              | description                           | diagnostic        |\n|:------------------|:--------------------------------------|:------------------|\n| shorten uri       | shorten uri into compacted form       | uncompacted uri   |\n| declare prefix    | declares undeclared prefix (if known) | undeclared prefix |\n| shorten all uri's | shorten all uri's into compacted form |                   |\n\n# \u2699\ufe0f  Configuration\n\nQlue-ls can be configured through a `qlue-ls.toml` or `qlue-ls.yml` file.\n\nHere is the full default configuration\n```toml\n[format]\nalign_predicates = true\nalign_prefixes = false\nseparate_prolouge = false\ncapitalize_keywords = true\ninsert_spaces = true\ntab_size = 2\nwhere_new_line = false\n```\n\n# \ud83c\udf10 use in web\n\nIf you want to connect from a web-based-editor, you can use this package as well.  \nFor this purpose this can be compiled to wasm and is available on [npm](https://www.npmjs.com/package/@ioannisnezis/sparql-language-server):\n\n\n```shell\nnpm i qlue-ls\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# \ud83d\ude4f Special Thanks\n\n* [TJ DeVries](https://github.com/tjdevries) for the inspiration and great tutorials\n* [Chris Biscardi](https://github.com/christopherbiscardi) for teaching me Rust\n* [GordianDziwis](https://github.com/GordianDziwis) for providing a sparql-tree-sitter grammar\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A formatter for SPARQL queries",
    "version": "0.2.2",
    "project_urls": {
        "Source Code": "https://github.com/IoannisNezis/qlue-ls"
    },
    "split_keywords": [
        "sparql",
        " rdf",
        " lsp",
        " lsp-server",
        " wasm"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "79dd2e79faed5aeab1915eff8b8fd52b6e1e8d3b8d7d55f79b69331bcb26edca",
                "md5": "f4f02154b8589d7b3d6efc989ba4937b",
                "sha256": "7bd434c5c3d627bf7f98d2a99a565f1aea11e0108507be59a496d2f0488d28c2"
            },
            "downloads": -1,
            "filename": "qlue_ls-0.2.2-py3-none-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "f4f02154b8589d7b3d6efc989ba4937b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 2196891,
            "upload_time": "2025-01-11T23:35:48",
            "upload_time_iso_8601": "2025-01-11T23:35:48.564645Z",
            "url": "https://files.pythonhosted.org/packages/79/dd/2e79faed5aeab1915eff8b8fd52b6e1e8d3b8d7d55f79b69331bcb26edca/qlue_ls-0.2.2-py3-none-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f56c7ee27893051b1865e74284c6a54efc63c121e697cc3d313bff9dcd301e6f",
                "md5": "95941882b38d6e539f0cc2aa421a36bf",
                "sha256": "6dd2074ceec9822bb4a873915e84e392d1131ab04cf33220a1ce9993bb73d998"
            },
            "downloads": -1,
            "filename": "qlue_ls-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "95941882b38d6e539f0cc2aa421a36bf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 568553,
            "upload_time": "2025-01-11T23:35:53",
            "upload_time_iso_8601": "2025-01-11T23:35:53.601864Z",
            "url": "https://files.pythonhosted.org/packages/f5/6c/7ee27893051b1865e74284c6a54efc63c121e697cc3d313bff9dcd301e6f/qlue_ls-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-11 23:35:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "IoannisNezis",
    "github_project": "qlue-ls",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "qlue-ls"
}
        
Elapsed time: 0.90205s