aboutsummaryrefslogtreecommitdiff
path: root/languages.toml
diff options
context:
space:
mode:
authorMichael Davis2022-10-22 00:34:15 +0000
committerGitHub2022-10-22 00:34:15 +0000
commit17daf6ac0a1a7ef4a44078ef11cc150a8fa41ff0 (patch)
treede02ccf9ca841688d73b3e7e5e4c4aca90cf0dcd /languages.toml
parent131d8392bbc3301ac4e0a392d92d08b08757b720 (diff)
Change syntax for suffix file-types configurations (#4414)
The change in d801a6693c3d475b3942f705d3ef48d7966bdf65 to search for suffixes in `file-types` is too permissive: files like the tutor or `*.txt` files are now mistakenly interpreted as R or perl, respectively. This change changes the syntax for specifying a file-types entry that matches by suffix: ```toml file-types = [{ suffix = ".git/config" }] ``` And changes the file-type detection to first search for any non-suffix patterns and then search for suffixes only with the file-types entries marked explicitly as suffixes.
Diffstat (limited to 'languages.toml')
-rw-r--r--languages.toml5
1 files changed, 2 insertions, 3 deletions
diff --git a/languages.toml b/languages.toml
index 5ad5c6e6..a639ccad 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1053,8 +1053,7 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-regex", rev = "e1cf
name = "git-config"
scope = "source.gitconfig"
roots = []
-# TODO: allow specifying file-types as a regex so we can read directory names (e.g. `.git/config`)
-file-types = [".gitmodules", ".gitconfig", ".git/config", ".config/git/config"]
+file-types = [".gitmodules", ".gitconfig", { suffix = ".git/config" }, { suffix = ".config/git/config" }]
injection-regex = "git-config"
comment-token = "#"
indent = { tab-width = 4, unit = "\t" }
@@ -1491,7 +1490,7 @@ source = { git = "https://github.com/bearcove/tree-sitter-meson", rev = "feea83b
[[language]]
name = "sshclientconfig"
scope = "source.sshclientconfig"
-file-types = [".ssh/config", "/etc/ssh/ssh_config"]
+file-types = [{ suffix = ".ssh/config" }, { suffix = "/etc/ssh/ssh_config" }]
roots = []
[[grammar]]