Metadata-Version: 2.4
Name: q-lang-server
Version: 1.0.1
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Rust
License-File: LICENSE.txt
Summary: q language server, written in Rust.
Keywords: kdb,q,language-server,lsp
Author-email: Jo Shinonome <jo.shinonome@gmail.com>
Requires-Python: >=3.7
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# q-lang-server

Offline [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) implementation for [kdb+](https://kdb.ai/) **q** and **k**, written in Rust and powered by [tree-sitter](https://tree-sitter.github.io/tree-sitter/).

The server binary is named `qls`.

## Install

```bash
pip install q-lang-server
```

Or with [uv](https://docs.astral.sh/uv/):

```bash
uv pip install q-lang-server
```

This installs the `qls` executable on your `PATH`.

### Build from source

```bash
cargo build --release -p q-lang-server
```

The binary is at `target/release/qls`.

## Features

- **Diagnostics** (linter)
- **Document formatting**
- Go to definition
- Find references
- Rename symbol (with prepare rename)
- Hover
- Document symbols and workspace symbols
- Document highlight
- Completion (with resolve)
- Signature help
- Semantic tokens

Source files are analyzed offline from the workspace. By default the server looks under `**/src/**/*.q` and `**/src/**/*.k`. Add `;` to mark statement ends when needed for more accurate parsing.

### Ignore directives

Place either comment above a block to skip analysis for that block:

```q
// q-lang-server-ignore-linter
// q-lang-server-ignore-formatter
```

## Editor setup

### Neovim

Use [chili-neovim](https://github.com/jshinonome/chili-neovim) for q/k syntax, process management, and LSP. It starts `qls` for `.q` / `.k` buffers by default.

1. Install `qls` (see above) and ensure it is on your `$PATH`.
2. Install chili-neovim with [lazy.nvim](https://github.com/folke/lazy.nvim):

Minimal:

```lua
{ "jshinonome/chili-neovim" }
```

With options and completion:

```lua
{
  "jshinonome/chili-neovim",
  main = "chili",
  dependencies = {
    "hrsh7th/nvim-cmp",
    "hrsh7th/cmp-nvim-lsp",
    "hrsh7th/cmp-buffer",
    "hrsh7th/cmp-vsnip",
    "hrsh7th/vim-vsnip",
  },
  opts = {
    qls = {
      cmd = { "qls" },
      filetypes = { "q" }, -- .q and .k
      document_highlight = true,
      format_on_save = true,
    },
  },
}
```

See the [chili-neovim README](https://github.com/jshinonome/chili-neovim) for process config, commands, and keybindings.

### Other editors

Any LSP client that can launch `qls` over stdio can use this server. Point the client at the `qls` binary and associate it with `q` and `k` filetypes.

## Related

- [chili-neovim](https://github.com/jshinonome/chili-neovim) — Neovim plugin for kdb+/q
- [vscode-q](https://github.com/jshinonome/vscode-q) — VS Code / Cursor extension that embeds this language server
- [Changelog](https://github.com/jshinonome/vscode-q/blob/main/CHANGELOG.md)

## License

Copyright 2026 Jo Shinonome. All rights reserved. See [LICENSE.txt](https://github.com/jshinonome/vscode-q/blob/main/LICENSE.txt).

