🌉 Introducing kakehashi VSCode extension — Bringing intelligent features to Markdown code blocks such as completions, hovers, diagnostics, and more

by
Categories:
Tags:

kakehashi lets you use intelligent features like completion and hover on source code embedded in another language — for example, the code blocks inside Markdown.

I built a VSCode extension so you can use kakehashi from VSCode too! Here’s how it works in action. Give it a try!

By the way, Markdown is just an example — kakehashi can be extended to a variety of document formats. I’ll save that story for another post…

How to install

  1. Install kakehashi (CLI)
    • Install via cargo or brew
      • brew install atusy/tap/kakehashi
      • cargo install --git https://github.com/atusy/kakehashi
    • Adjust your PATH environment variable if necessary
  2. Configure kakehashi (CLI)
    • Create ~/.config/kakehashi/kakehashi.toml

    • Configure the language servers for the languages you want to use with kakehashi

      # kakehashi.toml
      [languageServers.basedpyright]
      cmd = ["basedpyright-langserver", "--stdio"]
      languages = ["python"]
      
      [languageServers.r_language_server]
      cmd = [ "R", "--no-echo", "-e", "languageserver::run()"]
      languages = ["R", "r"]
  3. Install kakehashi (extension)
    • Search for kakehashi in the Marketplace, or run code --install-extension atusy.kakehashi-vscode
  4. Configure VSCode (settings.json)
    • Open the command palette with Ctrl+Shift+P and run Preferences: Open User Settings (JSON)

    • Add ["markdown"] and "kakehashi.documentSelector" as shown below

      {
        "[markdown]": { "editor.quickSuggestions": { "other": "on" } },
        "kakehashi.documentSelector": [ "markdown" ]
      }

If you want to use it with Quarto or R Markdown

  • Add configuration to kakehashi (CLI) toml [languages.qmd] base = "markdown" [languages.rmd] base = "markdown"
  • Add configuration to VSCode

ENJOY!!

If you’d like to learn more about kakehashi itself or the extension, please check the README in each repository. Stars are a huge motivation booster!!

As an R user you might be wondering about Positron support — it’s not supported yet! Stay tuned!!

Sponsorship is also very welcome!