Skip to content
ktav-langPublic

About

Editor support for the Ktav configuration format — VS Code, IntelliJ, LSP server, shared TextMate grammar

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

ktav-lang/editor

Release CI License: MIT OR Apache-2.0 Playground

Languages: English · Русский · 简体中文

Playground: convert JSON / YAML / TOML / INI ⇄ Ktav in your browser at ktav-lang.github.io.

Editor support for the Ktav configuration format — syntax highlighting, IDE plugins, and a Language Server. One repo, four subprojects, one shared TextMate grammar.

What's inside

Subproject What it is Install / publish to
grammars/ Shared TextMate grammar + VS Code language configuration Reused by vscode/ and intellij/
vscode/ Visual Studio Code extension VS Code Marketplace + Open VSX
intellij/ IntelliJ Platform plugin (IntelliJ IDEA, RustRover, GoLand, …) JetBrains Marketplace
lsp/ Language Server Protocol implementation (Rust, tower-lsp) crates.io as ktav-lsp
docs/ Editor-specific setup snippets (Helix, Neovim, Emacs, Sublime, Zed) —

What you get as a Ktav user

LSP features depend on the editor's client. The IntelliJ plugin integrates live diagnostics and whole-file formatting only; it does not integrate hover, completion, document symbols or semantic tokens. Its syntax highlighting is provided by a native lexer.

  • Syntax highlighting — keys, scalars, the literal-string marker (::), multi-line strings, comments
  • Bracket matching & auto-close — {} [] ()
  • Comment toggle — Ctrl/Cmd+/ → ## comment
  • Live diagnostics (with the LSP) — every MissingSeparatorSpace, duplicate key, dotted-prefix conflict surfaces as a red squiggle on the offending line, with the same message the parser emits
  • Hover info (with the LSP) — dotted path of the key under cursor, inferred type of the value
  • Completion (with the LSP) — keywords (null / true / false), the literal-string marker (::), compound openers
  • Document symbols (with the LSP) — outline reflecting the parsed Value::Object structure

Architecture

                       ┌─────────────────────────────────────┐
                       │ ktav-lsp  (Rust binary, this repo)  │
                       │ • parses via the `ktav` crate       │
                       │ • diagnostics, hover, completion,   │
                       │   semantic tokens, document symbols │
                       └─────────────────────────────────────┘
                                          ▲
                                          │ LSP (JSON-RPC over stdio)
                 ┌────────────────────────┼───────────────────────┐
                 │                        │                       │
       ┌─────────┴────────┐   ┌───────────┴──────────┐   ┌────────┴───────┐
       │ VS Code          │   │ IntelliJ Platform    │   │ Helix / Neovim │
       │ ext (`vscode/`)  │   │ plugin (`intellij/`) │   │ + LSP config   │
       │                  │   │                      │   │                │
       │ TextMate grammar │   │ Native lexer         │   │ Highlighting:  │
       │ from grammars/   │   │ (no TextMate)        │   │ client-specific│
       │                  │   │                      │   │ (see below)    │
       └──────────────────┘   └──────────────────────┘   └────────────────┘

The TextMate grammar (VS Code) and the native IntelliJ lexer both give instant cosmetic highlighting (no language server needed). The LSP server offers intelligent features, but each editor's client decides which are integrated. IntelliJ's built-in client provides live diagnostics and whole-file formatting only; it does not integrate hover, completion, document symbols or semantic tokens. Installing ktav-lsp on PATH does not enable those missing client integrations.

Stock Helix uses tree-sitter for highlighting, not LSP semantic tokens; this repo provides no Ktav tree-sitter grammar. The TextMate JSON cannot serve as one. Neovim semantic highlighting depends on its LSP client configuration. Zed additionally needs an extension registering the Ktav language and server adapter; settings alone do not attach LSP to Plain Text.

Installing as a user

VS Code

ext install ktav-lang.ktav

The extension auto-bundles the LSP server for the major platforms — no extra install step.

IntelliJ IDEA / RustRover / GoLand / etc.

Plugins → Marketplace → search Ktav → Install.

Helix

Add to ~/.config/helix/languages.toml:

[[language]]
name = "ktav"
file-types = ["ktav"]
language-servers = ["ktav-lsp"]

[language-server.ktav-lsp]
command = "ktav-lsp"

Then cargo install ktav-lsp --version 0.8.0 --locked.

Neovim

With nvim-lspconfig:

vim.filetype.add({ extension = { ktav = "ktav" } })
require("lspconfig.configs").ktav = {
  default_config = {
    cmd = { "ktav-lsp" },
    filetypes = { "ktav" },
    root_dir = require("lspconfig.util").root_pattern(".git"),
    settings = {},
  },
}
require("lspconfig").ktav.setup({})

Then cargo install ktav-lsp --version 0.8.0 --locked.

Other editors

See docs/ for Emacs (eglot), Sublime, and Zed.

Hacking on this repo

Each subproject has its own toolchain. See its README.md:

  • grammars/ — pure JSON; no build
  • vscode/ — Node + vsce
  • intellij/ — JDK 17 + Gradle
  • lsp/ — Rust 1.88+ (minimum required by the locked dependency graph)

A single tag triggers a release of all four (see .github/workflows/release.yml).

Versioning

Single semver across the monorepo: All four subprojects publish under the same tag at the same time. The CHANGELOG lists changes per subproject under each version heading.

License

MIT OR Apache-2.0. See LICENSE-MIT and LICENSE-APACHE.

Other Ktav implementations

  • spec — specification + conformance suite
  • rust — reference Rust crate (cargo add ktav)
  • csharp — C# / .NET (dotnet add package Ktav)
  • golang — Go (go get github.com/ktav-lang/golang)
  • java — Java / JVM (io.github.ktav-lang:ktav on Maven Central)
  • js — JS / TS (npm install @ktav-lang/ktav)
  • php — PHP (composer require ktav-lang/ktav)
  • python — Python (pip install ktav)

About

Editor support for the Ktav configuration format — VS Code, IntelliJ, LSP server, shared TextMate grammar

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages