qlue-ls


Nameqlue-ls JSON
Version 0.3.5 PyPI version JSON
download
home_pageNone
SummaryA formatter for SPARQL queries
upload_time2025-02-16 17:05:06
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 --bin qlue-ls 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
filter_same_line = true
```

# 🌐 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/e6/22/483bef2ba4944ce9e6c0d45105f30276cda77f2fc139db549578fb09c450/qlue_ls-0.3.5.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 --bin qlue-ls 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\nfilter_same_line = true\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.3.5",
    "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": "424146989f99a539310d770bd0003b75dc339b9839b2f43dcc3eef39d59c7358",
                "md5": "6d78f99d5d82d9b4e4e53e3d5a0b7ce4",
                "sha256": "fd26078d1d2d98a517b7fea512339e84d85dde5112b44bea5bb2c78dd151cafc"
            },
            "downloads": -1,
            "filename": "qlue_ls-0.3.5-py3-none-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "6d78f99d5d82d9b4e4e53e3d5a0b7ce4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 2222404,
            "upload_time": "2025-02-16T17:05:03",
            "upload_time_iso_8601": "2025-02-16T17:05:03.435335Z",
            "url": "https://files.pythonhosted.org/packages/42/41/46989f99a539310d770bd0003b75dc339b9839b2f43dcc3eef39d59c7358/qlue_ls-0.3.5-py3-none-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e622483bef2ba4944ce9e6c0d45105f30276cda77f2fc139db549578fb09c450",
                "md5": "f72c78013756920c5d7060479630fb65",
                "sha256": "12b66433e3ec5813544ae7391db2e714ddae2fc2103925a1c63768a6a35b1395"
            },
            "downloads": -1,
            "filename": "qlue_ls-0.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "f72c78013756920c5d7060479630fb65",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 634221,
            "upload_time": "2025-02-16T17:05:06",
            "upload_time_iso_8601": "2025-02-16T17:05:06.516588Z",
            "url": "https://files.pythonhosted.org/packages/e6/22/483bef2ba4944ce9e6c0d45105f30276cda77f2fc139db549578fb09c450/qlue_ls-0.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-16 17:05:06",
    "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.42056s