Metadata-Version: 2.4
Name: sqlakit-lsp
Version: 0.1.1
Summary: The language server for SQLAKit templates.
Keywords: sqlalchemy,sqlakit,lsp,language-server,sql
Author: Anton Ruhlov
Author-email: Anton Ruhlov <antonruhlov@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
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: Topic :: Database
Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
Classifier: Typing :: Typed
Requires-Dist: sqlakit>=0.21.0,<0.23
Requires-Dist: pygls>=2.1,<3
Requires-Python: >=3.11
Project-URL: Repository, https://github.com/sqlakit/sqlakit-lsp
Project-URL: Documentation, https://github.com/sqlakit/sqlakit-lsp#readme
Description-Content-Type: text/markdown

# sqlakit-lsp

The language server for [SQLAKit](https://sqlakit.readthedocs.io/en/stable/)
templates. In a `.sql` template:

- the problems `sqlakit check` finds, as you type
- completion after `tpl.` and in `tpl.include('`, and a macro's arguments while
  you write them
- on hover, the SQL a call writes, above the macro's signature and docstring
- go to definition, implementation and references of a macro or a template
- rename of a macro or a template across the project
- the macros' calls and the parameters coloured
- a parameter no call of the project passes, marked, with a quick fix for a
  name close to one the calls pass
- **Show rendered SQL**, the whole template as the SQL it writes
- the outline of a template, and a search for a macro or a template

In Python, the template name in `db.sql("...")` completes and links to its
file, and a value the template does not read is marked.

```console
$ pip install sqlakit-lsp
```

Register `sqlakit-lsp` for `.sql` and `.py` files in your editor. It talks over
stdio. In Neovim 0.11:

```lua
vim.lsp.config("sqlakit", {
  cmd = { "sqlakit-lsp" },
  filetypes = { "sql", "python" },
  root_markers = { "pyproject.toml" },
})
vim.lsp.enable("sqlakit")
```

Zed colours the macros' calls and the parameters of a template from the
server once its settings say `"semantic_tokens": "combined"`.

It reads the project the way `sqlakit check` does, from the `Templates(...)`
the code builds, without running it. [SQL
templates](https://sqlakit.readthedocs.io/en/stable/sql/#template-validation)
covers what it reads, and `[tool.sqlakit.templates]` for a project whose code
builds its paths in a way it can't follow.

## Development

```console
$ uv sync
$ uv run poe test
$ uv run poe lint
```
