on master help sign in
Support WIT grammar (#4525)
9df4358hh9527
book/src/generated/lang-support.md+1
@@ -126,6 +126,7 @@
126| wast | ✓ | | | |
126| wast | ✓ | | | |
127| wat | ✓ | | | |
127| wat | ✓ | | | |
128| wgsl | ✓ | | | `wgsl_analyzer` |
128| wgsl | ✓ | | | `wgsl_analyzer` |
129+| wit | ✓ | | ✓ | |
129| xit | ✓ | | | |
130| xit | ✓ | | | |
130| xml | ✓ | | ✓ | |
131| xml | ✓ | | ✓ | |
131| yaml | ✓ | | ✓ | `yaml-language-server` |
132| yaml | ✓ | | ✓ | `yaml-language-server` |
languages.toml+22
@@ -1917,3 +1917,25 @@ roots = []
1917[[grammar]]
1917[[grammar]]
1918name = "xml"
1918name = "xml"
1919source = { git = "https://github.com/RenjiSann/tree-sitter-xml", rev = "422528a43630db6dcc1e222d1c5ee3babd559473" }
1919source = { git = "https://github.com/RenjiSann/tree-sitter-xml", rev = "422528a43630db6dcc1e222d1c5ee3babd559473" }
1920+
1921+[[language]]
1922+name = "wit"
1923+scope = "source.wit"
1924+injection-regex = "wit"
1925+file-types = ["wit"]
1926+roots = []
1927+comment-token = "//"
1928+indent = { tab-width = 2, unit = " " }
1929+
1930+[language.auto-pairs]
1931+'(' = ')'
1932+'{' = '}'
1933+'[' = ']'
1934+'"' = '"'
1935+"'" = "'"
1936+"<" = ">"
1937+
1938+[[grammar]]
1939+name = "wit"
1940+source = { git = "https://github.com/hh9527/tree-sitter-wit", rev = "c917790ab9aec50c5fd664cbfad8dd45110cfff3" }
1941+
runtime/queries/wit/highlights.scmnew file+67
@@ -0,0 +1,67 @@
1+(line_comment) @comment.line
2+(block_comment) @comment.block
3+(ty (ident) @type)
4+
5+(item_type name: (ident) @type)
6+(item_record name: (ident) @type)
7+(item_variant name: (ident) @type)
8+(item_flags name: (ident) @type)
9+(item_enum name: (ident) @type)
10+(item_union name: (ident) @type)
11+(item_resource name: (ident) @type)
12+
13+(item_use from: (ident) @namespace)
14+(use_item name: (ident) @type)
15+(item_func name: (ident) @function)
16+(method name: (ident) @function.method)
17+(fields (named_ty name: (ident) @variable.other.member))
18+(input (args (named_ty name: (ident) @variable.parameter)))
19+(output (args (named_ty name: (ident) @variable.other.member)))
20+(flags (ident) @constant)
21+(enum_items (ident) @constant)
22+(variant_item tag: (ident) @type.enum.variant)
23+
24+[
25+ (unit)
26+
27+ "u8" "u16" "u32" "u64"
28+ "s8" "s16" "s32" "s64"
29+ "float32" "float64"
30+ "char" "bool" "string"
31+] @type.builtin
32+
33+[
34+ "list"
35+ "option"
36+ "result"
37+ "tuple"
38+ "future"
39+ "stream"
40+] @function.macro
41+
42+[ "," ":" ] @punctuation.delimiter
43+[ "(" ")" "{" "}" "<" ">" ] @punctuation.bracket
44+[ "=" "->" ] @operator
45+
46+[
47+ "record"
48+ "flags"
49+ "variant"
50+ "enum"
51+ "union"
52+ "type"
53+ "resource"
54+] @keyword.storage.type
55+
56+"func" @keyword
57+
58+[
59+ "static"
60+] @keyword.storage.modifier
61+
62+[
63+ (star)
64+ "use"
65+ "as"
66+ "from"
67+] @keyword.control.import
runtime/queries/wit/indents.scmnew file+13
@@ -0,0 +1,13 @@
1+[
2+ (use_items)
3+ (fields)
4+ (variant_items)
5+ (variant_payload)
6+ (flags)
7+ (enum_items)
8+ (union_items)
9+ (args)
10+ (resource_items)
11+] @indent
12+
13+[ "}" ")" ] @outdent