on master help sign in
Add Nickel language (#2173)
9616477Erin van der Veen
book/src/generated/lang-support.md+1
@@ -46,6 +46,7 @@
46| make | ✓ | | | |
46| make | ✓ | | | |
47| markdown | ✓ | | | |
47| markdown | ✓ | | | |
48| mint | | | | `mint` |
48| mint | | | | `mint` |
49+| nickel | ✓ | | ✓ | `nls` |
49| nix | ✓ | | ✓ | `rnix-lsp` |
50| nix | ✓ | | ✓ | `rnix-lsp` |
50| ocaml | ✓ | | ✓ | `ocamllsp` |
51| ocaml | ✓ | | ✓ | `ocamllsp` |
51| ocaml-interface | ✓ | | | `ocamllsp` |
52| ocaml-interface | ✓ | | | `ocamllsp` |
languages.toml+15
@@ -380,6 +380,21 @@ indent = { tab-width = 4, unit = " " }
380name = "python"
380name = "python"
381source = { git = "https://github.com/tree-sitter/tree-sitter-python", rev = "d6210ceab11e8d812d4ab59c07c81458ec6e5184" }
381source = { git = "https://github.com/tree-sitter/tree-sitter-python", rev = "d6210ceab11e8d812d4ab59c07c81458ec6e5184" }
382
382
383+[[language]]
384+name = "nickel"
385+scope = "source.nickel"
386+injection-regex = "nickel"
387+file-types = ["ncl"]
388+shebangs = []
389+roots = []
390+comment-token = "#"
391+language-server = { command = "nls" }
392+indent = { tab-width = 2, unit = " " }
393+
394+[[grammar]]
395+name = "nickel"
396+source = { git = "https://github.com/nickel-lang/tree-sitter-nickel", rev = "85348774ccf7624fac72703b2264d18b6f572be6" }
397+
383[[language]]
398[[language]]
384name = "nix"
399name = "nix"
385scope = "source.nix"
400scope = "source.nix"
runtime/queries/nickel/highlights.scmnew file+67
@@ -0,0 +1,67 @@
1+(types) @type
2+(type_builtin) @type.builtin
3+"Array" @type.builtin
4+
5+(enum_tag) @constructor
6+
7+"null" @constant.builtin
8+(bool) @constant.builtin.boolean
9+(str_esc_char) @constant.character.escape
10+(num_literal) @constant.numeric
11+
12+(str_chunks) @string
13+
14+; NOTE: Nickel has no block comments
15+(comment) @comment.line
16+; Nickel doesn't use comments for documentation, ideally this would be
17+; `@documentation` or something similar
18+(annot_atom
19+ doc: (static_string) @comment.block.documentation
20+)
21+
22+(record_operand (atom (ident) @variable))
23+(let_expr
24+ "let" @keyword
25+ pat: (pattern
26+ (ident) @variable
27+ )
28+ "in" @keyword
29+)
30+(fun_expr
31+ "fun" @keyword.function
32+ pats:
33+ (pattern
34+ id: (ident) @variable.parameter
35+ )+
36+ "=>" @operator
37+)
38+(record_field) @variable.other.member
39+
40+[
41+ "."
42+] @punctuation.delimiter
43+[
44+ "{" "}"
45+ "(" ")"
46+ "[|" "|]"
47+ "[" "]"
48+] @punctuation.bracket
49+(multstr_start) @punctuation.bracket
50+(multstr_end) @punctuation.bracket
51+(interpolation_start) @punctuation.bracket
52+(interpolation_end) @punctuation.bracket
53+
54+["forall" "default" "doc"] @keyword
55+["if" "then" "else" "switch"] @keyword.control.conditional
56+"import" @keyword.control.import
57+
58+(infix_expr
59+ op: (_) @operator
60+)
61+
62+(applicative
63+ t1: (applicative
64+ (record_operand) @function
65+ )
66+)
67+(builtin) @function.builtin
runtime/queries/nickel/indents.scmnew file+17
@@ -0,0 +1,17 @@
1+[
2+ (fun_expr)
3+ (let_expr)
4+ (switch_expr)
5+ (ite_expr)
6+
7+ (uni_record)
8+ (str_chunks_multi)
9+ "["
10+ "[|"
11+] @indent
12+
13+[
14+ "}"
15+ "]"
16+ "|]"
17+] @outdent