This commit is contained in:
Bruno BELANYI 2024-05-07 11:09:47 +00:00
parent e0b66e89f9
commit 6d228a0a32
8 changed files with 149 additions and 0 deletions

View file

@ -13,6 +13,7 @@ let
"after"
"autoload"
"ftdetect"
"queries"
"lua"
"plugin"
];
@ -67,6 +68,7 @@ in
lsp_lines-nvim # Show diagnostics *over* regions
none-ls-nvim # LSP integration for linters and formatters
nvim-treesitter.withAllGrammars # Better highlighting
(pkgs.vimPlugins.nvim-treesitter.grammarToPlugin pkgs.tree-sitter-bp)
nvim-treesitter-textobjects # More textobjects
plenary-nvim # 'null-ls', 'telescope' dependency

View file

@ -1,4 +1,13 @@
local ts_config = require("nvim-treesitter.configs")
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.bp = {
install_info = {
url = "",
files = { "src/parser.c" },
},
}
ts_config.setup({
highlight = {
enable = true,

View file

@ -0,0 +1,8 @@
[
(list_expression)
(map_expression)
(module)
(select_expression)
] @fold
; vim: sw=2 foldmethod=marker

View file

@ -0,0 +1,67 @@
(comment) @comment
; Operators {{{
(operator) @operator
(integer_literal ("-") @operator)
; }}}
; Punctuation {{{
[
","
":"
] @punctuation.delimiter
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
; }}}
; Literal {{{
(boolean_literal) @boolean
(integer_literal) @number
[
(raw_string_literal)
(interpreted_string_literal)
] @string
(escape_sequence) @string.escape
; }}}
; Declarations {{{
(identifier) @variable
(module
type: (identifier) @function.call)
(module
(property
field: (identifier) @variable.parameter))
; }}}
; Built-ins {{{
[
(unset)
(default)
] @variable.builtin
(condition
name: (identifier) @function.builtin)
; }}}
; Expressions {{{
(map_expression
(property
field: (identifier) @property))
(select_expression
"select" @keyword.conditional)
; }}}
; vim: sw=2 foldmethod=marker

View file

@ -0,0 +1,27 @@
; Expressions {{{
(list_expression) @indent.begin
(list_expression
"]" @indent.branch)
(map_expression) @indent.begin
(map_expression
"}" @indent.branch)
(select_expression) @indent.begin
(select_expression
")" @indent.branch)
(select_cases) @indent.begin
(select_cases
"}" @indent.branch)
; }}}
; Declarations {{{
(module) @indent.begin
(module
")" @indent.branch)
(module
"}" @indent.branch)
; }}}
; vim: sw=2 foldmethod=marker

View file

@ -0,0 +1,4 @@
((comment) @injection.content
(#set! injection.language "comment"))
; vim: sw=2 foldmethod=marker

View file

@ -0,0 +1,14 @@
(module
(property
field: (identifier) @local.definition.parameter))
(map_expression
(property
field: (identifier) @local.definition.field))
(assignment
left: (identifier) @local.definition.var)
(identifier) @local.reference
; vim: sw=2 foldmethod=marker

View file

@ -0,0 +1,18 @@
self: prev:
let
tree-sitter = prev.tree-sitter.override {
extraGrammars = {
tree-sitter-bp = {
src = self.fetchFromGitHub {
owner = "ambroisie";
repo = "tree-sitter-bp";
rev = "v0.4.0";
hash = "sha256-h9T8tfS2K85N9NLwYj6tu2MHPj4YyG/UBYoezfWuEyI=";
};
};
};
};
in
{
inherit (tree-sitter.passthru.builtGrammars) tree-sitter-bp;
}