feat(languages): git-ignore and git-attributes (#2397)
This commit is contained in:
parent
fc61796895
commit
a5f4925f53
5 changed files with 63 additions and 1 deletions
|
@ -20,9 +20,11 @@
|
||||||
| erlang | ✓ | | | `erlang_ls` |
|
| erlang | ✓ | | | `erlang_ls` |
|
||||||
| fish | ✓ | ✓ | ✓ | |
|
| fish | ✓ | ✓ | ✓ | |
|
||||||
| gdscript | ✓ | | ✓ | |
|
| gdscript | ✓ | | ✓ | |
|
||||||
|
| git-attributes | ✓ | | | |
|
||||||
| git-commit | ✓ | | | |
|
| git-commit | ✓ | | | |
|
||||||
| git-config | ✓ | | | |
|
| git-config | ✓ | | | |
|
||||||
| git-diff | ✓ | | | |
|
| git-diff | ✓ | | | |
|
||||||
|
| git-ignore | ✓ | | | |
|
||||||
| git-rebase | ✓ | | | |
|
| git-rebase | ✓ | | | |
|
||||||
| gleam | ✓ | | | |
|
| gleam | ✓ | | | |
|
||||||
| glsl | ✓ | | ✓ | |
|
| glsl | ✓ | | ✓ | |
|
||||||
|
|
|
@ -321,7 +321,7 @@ impl TextObjectQuery {
|
||||||
|
|
||||||
fn read_query(language: &str, filename: &str) -> String {
|
fn read_query(language: &str, filename: &str) -> String {
|
||||||
static INHERITS_REGEX: Lazy<Regex> =
|
static INHERITS_REGEX: Lazy<Regex> =
|
||||||
Lazy::new(|| Regex::new(r";+\s*inherits\s*:?\s*([a-z_,()]+)\s*").unwrap());
|
Lazy::new(|| Regex::new(r";+\s*inherits\s*:?\s*([a-z_,()-]+)\s*").unwrap());
|
||||||
|
|
||||||
let query = load_runtime_file(language, filename).unwrap_or_default();
|
let query = load_runtime_file(language, filename).unwrap_or_default();
|
||||||
|
|
||||||
|
|
|
@ -956,6 +956,32 @@ indent = { tab-width = 4, unit = "\t" }
|
||||||
name = "git-config"
|
name = "git-config"
|
||||||
source = { git = "https://github.com/the-mikedavis/tree-sitter-git-config", rev = "0e4f0baf90b57e5aeb62dcdbf03062c6315d43ea" }
|
source = { git = "https://github.com/the-mikedavis/tree-sitter-git-config", rev = "0e4f0baf90b57e5aeb62dcdbf03062c6315d43ea" }
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "git-attributes"
|
||||||
|
scope = "source.gitattributes"
|
||||||
|
roots = []
|
||||||
|
file-types = [".gitattributes"]
|
||||||
|
injection-regex = "git-attributes"
|
||||||
|
comment-token = "#"
|
||||||
|
grammar = "gitattributes"
|
||||||
|
|
||||||
|
[[grammar]]
|
||||||
|
name = "gitattributes"
|
||||||
|
source = { git = "https://github.com/mtoohey31/tree-sitter-gitattributes", rev = "3dd50808e3096f93dccd5e9dc7dc3dba2eb12dc4" }
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "git-ignore"
|
||||||
|
scope = "source.gitignore"
|
||||||
|
roots = []
|
||||||
|
file-types = [".gitignore"]
|
||||||
|
injection-regex = "git-ignore"
|
||||||
|
comment-token = "#"
|
||||||
|
grammar = "gitignore"
|
||||||
|
|
||||||
|
[[grammar]]
|
||||||
|
name = "gitignore"
|
||||||
|
source = { git = "https://github.com/shunsambongi/tree-sitter-gitignore", rev = "f4685bf11ac466dd278449bcfe5fd014e94aa504" }
|
||||||
|
|
||||||
[[language]]
|
[[language]]
|
||||||
name = "graphql"
|
name = "graphql"
|
||||||
scope = "source.graphql"
|
scope = "source.graphql"
|
||||||
|
|
9
runtime/queries/git-attributes/highlights.scm
Normal file
9
runtime/queries/git-attributes/highlights.scm
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
; inherits: git-ignore
|
||||||
|
|
||||||
|
(attribute) @variable
|
||||||
|
(value) @string
|
||||||
|
|
||||||
|
(quoted_pattern ["\""] @string)
|
||||||
|
|
||||||
|
(attribute_unset) @operator
|
||||||
|
(attribute_set_to) @operator
|
25
runtime/queries/git-ignore/highlights.scm
Normal file
25
runtime/queries/git-ignore/highlights.scm
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
(pattern_char) @string
|
||||||
|
(pattern_char_escaped) @constant.character.escape
|
||||||
|
|
||||||
|
(directory_separator) @string
|
||||||
|
(directory_separator_escaped) @constant.character.escape
|
||||||
|
|
||||||
|
(negation) @operator
|
||||||
|
|
||||||
|
(wildcard_char_single) @operator
|
||||||
|
(wildcard_chars) @operator
|
||||||
|
(wildcard_chars_allow_slash) @operator
|
||||||
|
|
||||||
|
(bracket_char) @string
|
||||||
|
(bracket_char_escaped) @constant.character.escape
|
||||||
|
|
||||||
|
(bracket_negation) @operator
|
||||||
|
(bracket_range) @operator
|
||||||
|
(bracket_char_class) @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
(comment) @comment
|
Loading…
Reference in a new issue