Configure language and fix highlighting for dart

pull/185/head
Wilfred Hughes 2022-03-20 11:34:24 +07:00
parent b60ab25850
commit 29050f00ce
5 changed files with 12 additions and 5 deletions

@ -10,6 +10,7 @@ tool that understands syntax. It supports the following languages:
* Clojure
* Common Lisp
* CSS
* Dart
* Elixir
* Emacs Lisp
* Go

@ -19,6 +19,9 @@ b5e718eb8328f8df8aff0eddf4e46d1a -
sample_files/css_before.css sample_files/css_after.css
a110f9a9ab8586f2f307df3cc9997ead -
sample_files/dart_before.dart sample_files/dart_after.dart
aeed85d8cb8905197268309894a2945e -
sample_files/elisp_before.el sample_files/elisp_after.el
c2871ec588ad8dd1e8c482efc4662f42 -

@ -183,6 +183,7 @@ fn from_extension(extension: &OsStr, src: &str) -> Option<Language> {
"lisp" | "lsp" | "asd" => Some(CommonLisp),
"cs" => Some(CSharp),
"css" => Some(Css),
"dart" => Some(Dart),
"el" => Some(EmacsLisp),
"ex" | "exs" => Some(Elixir),
"go" => Some(Go),

@ -194,9 +194,9 @@ pub fn from_language(language: guess::Language) -> TreeSitterConfig {
Dart => {
let language = unsafe { tree_sitter_dart() };
TreeSitterConfig {
name: "CSS",
name: "Dart",
language,
atom_nodes: HashSet::new(),
atom_nodes: (vec!["string_literal"]).into_iter().collect(),
delimiter_tokens: (vec![("{", "}"), ("(", ")"), ("[", "]"), ("<", ">")]),
highlight_query: ts::Query::new(
language,

@ -118,8 +118,10 @@
; distinguish method call from variable access
(unconditional_assignable_selector
(identifier) @property)
(assignable_selector
(identifier) @property)
;; https://github.com/UserNobody14/tree-sitter-dart/issues/24
;; (assignable_selector
;; (identifier) @property)
; assignments
(assignment_expression
@ -223,4 +225,4 @@
["do" "while" "continue" "for"] @repeat
; Error
(ERROR) @error
(ERROR) @error