Skip to content

atusy/kakehashi

Repository files navigation

πŸŒ‰ kakehashi (ζžΆγ‘ζ©‹)

kakehashi is a bridge (ζžΆγ‘ζ©‹) across your editors, your languages, and the language servers that make them smart.

  • bridge to consistent syntax highlighting and smart selection β€” for any language with a Tree-sitter grammar
  • bridge to your language servers' features β€” configured once in kakehashi, available in any editor
  • bridge to all of the above β€” even for code embedded inside other code
flowchart TB
    K[πŸŒ‰ kakehashi] <-->|Highlighting, selection,<br>and more β€” everywhere| E["Your editor<br>(any LSP client)"]
    K <-.->|Borrows the smarts of<br>real language servers| LS["pyright, rust-analyzer,<br>and friends"]
Loading

🎨 Highlighting & smart selection, for any language

Open a file and kakehashi highlights it β€” consistently, in every editor. It parses with Tree-sitter, so any language with a grammar just works (that's hundreds of them), and it fetches the grammar it needs automatically the first time you open a file. No manual installs, no config to get started.

The same engine powers smart selection: grow or shrink your selection along the code's real structure, not just by lines and words.

Need a niche language, or want highlighting your way? Bring your own Tree-sitter grammar and query files and kakehashi picks them up too β€” nothing is locked in.

πŸ”Œ Your language servers, in any editor

The deep features β€” completions, hover, go-to-definition β€” come from the real language servers you already trust, like pyright, rust-analyzer, or marksman. kakehashi connects your document to the right one and routes its answers back into your editor.

Best of all, you set them up once in kakehashi. Move from Neovim to VS Code to Helix and the same language tooling follows you β€” no per-editor configuration to redo.

πŸͺ„ …even for code inside code

You're writing a Markdown README, a Jupyter-style notebook, or an R Markdown report. It's full of embedded code:

```python
import pandas as pd
df = pd.read_csv("data.csv")
df.   # ← completions, right here
```

kakehashi spots these embedded regions and reaches both bridges right inside them:

  • ✨ Highlighting that understands each embedded language
  • 🧠 Completions, hover, and go-to-definition from its language server, inline
  • 🎯 Smart selection that follows the embedded code's structure

The same trick works anywhere languages nest β€” SQL in a JavaScript string, CSS and JavaScript in HTML, code blocks in Markdown. A single Markdown file can get marksman for the prose and pyright for the Python blocks, all at once.

Take it for a spin

Want to see kakehashi in action before wiring it into your own setup? Clone the repo and launch a ready-to-go Neovim:

make deps/nvim
nvim -u scripts/minimal_init.lua

Open a Markdown file with a code block and watch the highlighting and completions light up.

Quick Start

1. Install

Download the binary for your platform from GitHub Releases and put it on your PATH.

To let kakehashi auto-install the parsers it needs, make sure a C compiler is available (xcode-select --install on macOS, build-essential on Debian/Ubuntu, Build Tools on Windows).

2. Wire it into your editor

Neovim (built-in LSP, 0.11+):

vim.lsp.config.kakehashi = {
    cmd = { "kakehashi" },
    init_options = { autoInstall = true },
    on_attach = function(_, bufnr)
        -- Let kakehashi own highlighting (avoids double-highlighting)
        vim.api.nvim_create_autocmd("LspTokenUpdate", {
            buffer = bufnr,
            once = true,
            callback = function()
                vim.opt_local.syntax = "OFF"
                vim.treesitter.stop(bufnr)
            end,
        })
    end,
}
vim.lsp.enable("kakehashi")

Open a file and you'll have highlighting and smart selection immediately.

3. Bring in the language servers (optional)

Want completions and hover inside your code blocks? Point kakehashi at the language servers you already use β€” for example pyright for Python or lua-language-server for Lua.

See docs/README.md for the full setup: connecting language servers, configuring other editors, the CLI, and every option.

License

MIT

About

language server that bridges the gap between languages, editors, and tooling

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors