This is still a work in progress. It is a starting point to build out treesitter grammar for brightscript.
Note this type of setup is only needed until this tree-sitter project can make its way into nvim-treesitter
- requires nvim-treesitter
- filetype must be
brs
-- ~/.config/nvim/ftdetect/brs.lua
local api = vim.api
api.nvim_command("autocmd BufNewFile,BufFilePost,BufRead *.brs setfiletype brs")
-- ~/.config/nvim/init.lua
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.brightscript = {
install_info = {
url = "https://github.com/casonadams/tree-sitter-brightscript.git",
files = {"src/parser.c"},
branch = "main",
generate_requires_npm = false,
requires_generate_from_grammar = false,
},
filetype = "brs",
}
# ~/.config/helix/languages.toml
use-grammars = { only = [ "brightscript" ] }
[[grammar]]
name = "brightscript"
source = { git = "https://github.com/casonadams/tree-sitter-brightscript.git", rev = "main" }
mkdir -p ~/.local/share/nvim/site/pack/packer/start/nvim-treesitter/queries/brightscript
# packer
ln -s $(pwd)/queries/highlights.scm ~/.local/share/nvim/site/pack/packer/start/nvim-treesitter/queries/brightscript
# lazy
ln -sf $(pwd)/highlights.scm ~/.local/share/nvim/lazy/nvim-treesitter/queries/brightscript/highlights.scm
Requires that helix has been cloned and the runtime/ dir has been copied to ~/.config/helix/runtime
# from helix root dir
mkdir -p ~/.config/helix
cp -a runtime ~/.config/helix/
# from tree-sitter-brightscript root dir
mkdir -p ~/.config/helix/runtime/queries/brightscript
ln -s $(pwd)/queries/highlights.scm ~/.config/helix/runtime/queries/brightscript/highlights.scm
- Then build an and fetch
hx -g fetch
hx -g build