Skip to content

Commit

Permalink
add tree-sitter-nix
Browse files Browse the repository at this point in the history
  • Loading branch information
milahu committed Nov 24, 2021
1 parent cd0ef71 commit 617abbf
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 3 deletions.
60 changes: 60 additions & 0 deletions grammars/nix.json
@@ -0,0 +1,60 @@
{
"simpleTerms": {
"identifier": "variable",
"attr_identifier": "variable",

"integer": "number",
"float": "number",

"string": "string",
"indented_string": "string",
"path": "string",
"spath": "string",
"comment": "comment",

"interpolation": "control",

"null": "constant",
"true": "constant",
"false": "constant",

"\"if\"": "control",
"if": "control",
"\"else\"": "control",

"\".\"": "operator",
"\"->\"": "operator",
"\"*\"": "operator",
"\"-\"": "operator",
"\"+\"": "operator",
"\"/\"": "operator",
"\"++\"": "operator",
"\"==\"": "operator",
"\"!\"": "operator",
"\"!=\"": "operator",
"\"<\"": "operator",
"\">\"": "operator",
"\">=\"": "operator",
"\"<=\"": "operator",
"\"&&\"": "operator",
"\"||\"": "operator",
"\"=\"": "operator",
"\"?\"": "operator",
"\";\"": "punctuation",
"\"[\"": "punctuation",
"\"]\"": "punctuation",
"\",\"": "punctuation",
"\"{\"": "punctuation",
"\"}\"": "punctuation",
"\"(\"": "punctuation",
"\")\"": "punctuation"
},

"complexTerms": ["identifier", "attr_identifier"],

"complexScopes": {
"identifier": "variable",
"attr_identifier": "variable"
}

}
10 changes: 7 additions & 3 deletions package.json
Expand Up @@ -49,7 +49,8 @@
"Bash",
"OCaml",
"Lua",
"D"
"D",
"Nix"
],
"activationEvents": [
"onLanguage:c",
Expand All @@ -65,7 +66,8 @@
"onLanguage:shellscript",
"onLanguage:ocaml",
"onLanguage:lua",
"onLanguage:d"
"onLanguage:d",
"onLanguage:nix"
],
"main": "./out/extension.js",
"scripts": {
Expand Down Expand Up @@ -95,6 +97,7 @@
"tree-sitter-go": "^0.19.1",
"tree-sitter-javascript": "^0.19.0",
"tree-sitter-lua": "^1.6.2",
"tree-sitter-nix": "github:cstrahan/tree-sitter-nix",
"tree-sitter-ocaml": "^0.19.0",
"tree-sitter-php": "^0.19.0",
"tree-sitter-python": "^0.19.0",
Expand Down Expand Up @@ -149,7 +152,8 @@
"shellscript",
"ocaml",
"lua",
"d"
"d",
"nix"
]
},
"syntax.highlightTerms": {
Expand Down
13 changes: 13 additions & 0 deletions shell.nix
@@ -0,0 +1,13 @@
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {

nativeBuildInputs = [
];

buildInputs = with pkgs; [
gnumake # build tree-sitter
nodejs
];

}

0 comments on commit 617abbf

Please sign in to comment.