Skip to content

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

  • 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         │   │ (LSP semantic  │
       │ from grammars/   │   │ (no TextMate)        │   │  tokens for    │
       │                  │   │                      │   │  highlighting) │
       └──────────────────┘   └──────────────────────┘   └────────────────┘

The TextMate grammar (VS Code) and the native IntelliJ lexer both give instant cosmetic highlighting (no language server needed). The LSP layer adds the intelligent features — diagnostics, hover, completion. They stack: install the extension/plugin alone for highlighting, add ktav-lsp to your PATH for everything else.

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.

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.

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.71+

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