on master help sign in
feat(languages): git-ignore and git-attributes (#2397)
commita5f4925f53d447bb7201c9a6e7a1c2730f292ae4 authorMatthew Toohey <contact@mtoohey.com> dateThu 5 May 2022, 09:47 (4 years ago) parentfc61796
5 files changed+63−1
book/src/generated/lang-support.md+2 helix-core/src/syntax.rs+1−1 languages.toml+26 runtime/queries/git-attributes/highlights.scm+9 runtime/queries/git-ignore/highlights.scm+25
book/src/generated/lang-support.md+2
@@ -20,9 +20,11 @@
2020| erlang | ✓ | | | `erlang_ls` |
2121| fish | ✓ | ✓ | ✓ | |
2222| gdscript | ✓ | | ✓ | |
23+| git-attributes | ✓ | | | |
2324| git-commit | ✓ | | | |
2425| git-config | ✓ | | | |
2526| git-diff | ✓ | | | |
27+| git-ignore | ✓ | | | |
2628| git-rebase | ✓ | | | |
2729| gleam | ✓ | | | |
2830| glsl | ✓ | | ✓ | |
helix-core/src/syntax.rs+1−1
@@ -321,7 +321,7 @@ impl TextObjectQuery {
321321
322322fn read_query(language: &str, filename: &str) -> String {
323323 static INHERITS_REGEX: Lazy<Regex> =
324− Lazy::new(|| Regex::new(r";+\s*inherits\s*:?\s*([a-z_,()]+)\s*").unwrap());
324+ Lazy::new(|| Regex::new(r";+\s*inherits\s*:?\s*([a-z_,()-]+)\s*").unwrap());
325325
326326 let query = load_runtime_file(language, filename).unwrap_or_default();
327327
languages.toml+26
@@ -956,6 +956,32 @@ indent = { tab-width = 4, unit = "\t" }
956956name = "git-config"
957957source = { git = "https://github.com/the-mikedavis/tree-sitter-git-config", rev = "0e4f0baf90b57e5aeb62dcdbf03062c6315d43ea" }
958958
959+[[language]]
960+name = "git-attributes"
961+scope = "source.gitattributes"
962+roots = []
963+file-types = [".gitattributes"]
964+injection-regex = "git-attributes"
965+comment-token = "#"
966+grammar = "gitattributes"
967+
968+[[grammar]]
969+name = "gitattributes"
970+source = { git = "https://github.com/mtoohey31/tree-sitter-gitattributes", rev = "3dd50808e3096f93dccd5e9dc7dc3dba2eb12dc4" }
971+
972+[[language]]
973+name = "git-ignore"
974+scope = "source.gitignore"
975+roots = []
976+file-types = [".gitignore"]
977+injection-regex = "git-ignore"
978+comment-token = "#"
979+grammar = "gitignore"
980+
981+[[grammar]]
982+name = "gitignore"
983+source = { git = "https://github.com/shunsambongi/tree-sitter-gitignore", rev = "f4685bf11ac466dd278449bcfe5fd014e94aa504" }
984+
959985[[language]]
960986name = "graphql"
961987scope = "source.graphql"
runtime/queries/git-attributes/highlights.scmnew file+9
@@ -0,0 +1,9 @@
1+; inherits: git-ignore
2+
3+(attribute) @variable
4+(value) @string
5+
6+(quoted_pattern ["\""] @string)
7+
8+(attribute_unset) @operator
9+(attribute_set_to) @operator
runtime/queries/git-ignore/highlights.scmnew file+25
@@ -0,0 +1,25 @@
1+(pattern_char) @string
2+(pattern_char_escaped) @constant.character.escape
3+
4+(directory_separator) @string
5+(directory_separator_escaped) @constant.character.escape
6+
7+(negation) @operator
8+
9+(wildcard_char_single) @operator
10+(wildcard_chars) @operator
11+(wildcard_chars_allow_slash) @operator
12+
13+(bracket_char) @string
14+(bracket_char_escaped) @constant.character.escape
15+
16+(bracket_negation) @operator
17+(bracket_range) @operator
18+(bracket_char_class) @keyword
19+
20+[
21+ "["
22+ "]"
23+] @punctuation.bracket
24+
25+(comment) @comment