Expand file associations

pull/70/head
Wilfred Hughes 2021-11-25 00:07:36 +07:00
parent 79ba1be877
commit 4b0f7708ae
2 changed files with 6 additions and 4 deletions

@ -6,6 +6,8 @@ Added Bash and Ruby support.
Updated the C, CSS and JSON parsers to the latest upstream versions.
Expanded filename associations, so difftastic recognises more files.
## 0.12
### Display

@ -94,7 +94,7 @@ pub fn from_extension(extension: &OsStr) -> Option<TreeSitterConfig> {
//
// TODO: allow users to override the association between
// extensions and parses.
"cc" | "cpp" | "h" | "hpp" => Some(TreeSitterConfig {
"cc" | "cpp" | "h" | "hh" | "hpp" | "cxx" => Some(TreeSitterConfig {
name: "C++",
language: unsafe { tree_sitter_cpp() },
// The C++ grammar extends the C grammar, so the node
@ -139,7 +139,7 @@ pub fn from_extension(extension: &OsStr) -> Option<TreeSitterConfig> {
delimiter_tokens: (vec![("{", "}"), ("(", ")")]),
highlight_queries: include_str!("../vendor/highlights/css.scm"),
}),
"el" => Some(TreeSitterConfig {
"el" | ".emacs" => Some(TreeSitterConfig {
name: "Emacs Lisp",
language: unsafe { tree_sitter_elisp() },
atom_nodes: (vec![]).into_iter().collect(),
@ -219,14 +219,14 @@ pub fn from_extension(extension: &OsStr) -> Option<TreeSitterConfig> {
delimiter_tokens: (vec![("(", ")"), ("[", "]"), ("{", "}")]),
highlight_queries: include_str!("../vendor/highlights/ocaml.scm"),
}),
"py" => Some(TreeSitterConfig {
"py" | "py3" | "pyi" | "TARGETS" | "BUCK" | "bzl" => Some(TreeSitterConfig {
name: "Python",
language: unsafe { tree_sitter_python() },
atom_nodes: (vec!["string"]).into_iter().collect(),
delimiter_tokens: (vec![("(", ")"), ("[", "]"), ("{", "}")]),
highlight_queries: include_str!("../vendor/highlights/python.scm"),
}),
"rb" => Some(TreeSitterConfig {
"rb" | "spec" | "rake" => Some(TreeSitterConfig {
name: "Ruby",
language: unsafe { tree_sitter_ruby() },
atom_nodes: (vec!["string", "heredoc_body", "regex"])