Editor Setup#

Bark has a language server (bark-lsp) that provides editor support through the Language Server Protocol.

Features#

  • Syntax highlighting – tree-sitter grammar for Helix, Neovim, Zed, and others; TextMate grammar for VS Code; Vim syntax plugin
  • Diagnostics – parse errors shown inline as you type
  • Completion – keywords, types, builtins, module functions, and user-defined functions
  • Hover – documentation for builtins, keywords, and functions
  • Document symbols – outline of function declarations
  • Go to definition – jump to function definitions

Install bark-lsp#

Requires Go 1.25+.

go install gitlab.com/bark-lang/bark-lsp/cmd/bark-lsp@latest

Or build from source:

git clone https://gitlab.com/bark-lang/bark-lsp.git
cd bark-lsp
go install ./cmd/bark-lsp

Verify the binary is on your PATH:

which bark-lsp

Helix#

Syntax highlighting#

Bark provides a tree-sitter grammar for full syntax highlighting in Helix.

  1. Add to ~/.config/helix/languages.toml:
[language-server.bark-lsp]
command = "bark-lsp"

[[language]]
name = "bark"
scope = "source.bark"
file-types = ["bark"]
comment-tokens = "//"
indent = { tab-width = 2, unit = "  " }
language-servers = ["bark-lsp"]
roots = []

[language.auto-pairs]
'(' = ')'
'{' = '}'
'[' = ']'
'"' = '"'

[[grammar]]
name = "bark"
source = { path = "/path/to/bark-lsp/tree-sitter" }

Replace /path/to/bark-lsp with the actual path to your clone.

  1. Create the runtime directories and build the grammar:
mkdir -p ~/.config/helix/runtime/grammars
hx --grammar build
  1. Copy the query files into the Helix runtime:
mkdir -p ~/.config/helix/runtime/queries/bark
cp /path/to/bark-lsp/tree-sitter/queries/*.scm \
   ~/.config/helix/runtime/queries/bark/

Open any .bark file and you will have syntax highlighting and LSP support.

Neovim#

Syntax highlighting#

Neovim supports syntax highlighting through tree-sitter. You can register the Bark parser with nvim-treesitter:

local parser_config = require("nvim-treesitter.parsers").get_parser_configs()

parser_config.bark = {
  install_info = {
    url = "/path/to/bark-lsp/tree-sitter",
    files = { "src/parser.c" },
  },
  filetype = "bark",
}

Replace /path/to/bark-lsp with the actual path to your clone. Then install the parser:

:TSInstall bark

Copy the query files so nvim-treesitter can find them:

mkdir -p ~/.config/nvim/queries/bark
cp /path/to/bark-lsp/tree-sitter/queries/*.scm \
   ~/.config/nvim/queries/bark/

LSP support#

Add to your Neovim configuration:

vim.filetype.add({
  extension = { bark = "bark" },
})

vim.api.nvim_create_autocmd("FileType", {
  pattern = "bark",
  callback = function()
    vim.lsp.start({
      name = "bark-lsp",
      cmd = { "bark-lsp" },
    })
  end,
})

VS Code#

Language association#

VS Code does not recognize .bark files by default. To register the Bark language, install the minimal extension bundled with bark-lsp:

ln -s /path/to/bark-lsp/editors/vscode ~/.vscode/extensions/bark-lang

Replace /path/to/bark-lsp with the actual path to your clone of the bark-lsp repository. Restart VS Code after creating the symlink. .bark files will now be recognized as Bark with syntax highlighting, comment toggling, bracket matching, and auto-indentation.

LSP support#

Use a generic LSP client extension such as Generic LSP Client and add to your .vscode/settings.json:

{
  "genericLSP.languages": [
    {
      "id": "bark",
      "extensions": [".bark"],
      "server": { "command": "bark-lsp" }
    }
  ]
}

Vim#

Bark ships with a traditional Vim syntax plugin that provides syntax highlighting, file detection, and indentation.

Add the plugin to your runtime path in ~/.vimrc or ~/.config/nvim/init.vim:

set runtimepath+=/path/to/bark-lsp/editors/vim

Replace /path/to/bark-lsp with the actual path to your clone. Alternatively, symlink the individual directories:

ln -s /path/to/bark-lsp/editors/vim/syntax/bark.vim ~/.vim/syntax/bark.vim
ln -s /path/to/bark-lsp/editors/vim/ftdetect/bark.vim ~/.vim/ftdetect/bark.vim
ln -s /path/to/bark-lsp/editors/vim/indent/bark.vim ~/.vim/indent/bark.vim

Other Editors#

Tree-sitter grammar#

A full tree-sitter grammar is available for editors that support tree-sitter, including Zed, Emacs (via tree-sitter-langs), and others. The grammar includes highlight, locals, and tags queries.

LSP#

bark-lsp communicates over stdin/stdout using JSON-RPC 2.0. Any editor with LSP support can use it by pointing to the bark-lsp binary.

Troubleshooting#

Logs are written to /tmp/bark-lsp.log:

tail -f /tmp/bark-lsp.log

For more details, see the bark-lsp repository.