Treat predefined_type as an atom in TypeScript

Currently it contains a nested string node, even though it's a fixed
set of known types. This was preventing us from applying good syntax
highlighting.

This was particularly noticeable with `string`, which wasn't
previously highlighted as a type.
pull/454/head 0.41.0
Wilfred Hughes 2023-01-07 22:42:08 +07:00
parent 610a6e441d
commit 34967f588d
5 changed files with 15 additions and 1 deletions

@ -23,6 +23,8 @@ constituents.
Fixed an issue with unwanted underlines with textual diffing when
DFT_GRAPH_LIMIT is reached.
Improved syntax highlighintg for predefined types in TypeScript.
## 0.40 (released 28th December 2022)
### Diffing

@ -202,6 +202,9 @@ b142169ae6ac08ef64d0cf67a2e66f5b -
sample_files/toml_before.toml sample_files/toml_after.toml
08dad07d7c85b807094b5b4cf065cda9 -
sample_files/typescript_before.ts sample_files/typescript_after.ts
06648ebbe63a69e29de54b541fa2b3b8 -
sample_files/typing_before.ml sample_files/typing_after.ml
544c31c1d6651437ba9ed3a3a3524d76 -

@ -0,0 +1,5 @@
type Symbol = {
kind: "symbol";
name: string;
items: string[];
};

@ -0,0 +1,4 @@
type Symbol = {
kind: "symbol";
items: string[];
};

@ -859,7 +859,7 @@ pub fn from_language(language: guess::Language) -> TreeSitterConfig {
let language = unsafe { tree_sitter_typescript() };
TreeSitterConfig {
language,
atom_nodes: vec!["string", "template_string", "regex"]
atom_nodes: vec!["string", "template_string", "regex", "predefined_type"]
.into_iter()
.collect(),
delimiter_tokens: vec![("{", "}"), ("(", ")"), ("[", "]"), ("<", ">")],