Skip to content

Commit

Permalink
Use tree-sitter-typescript from crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Dec 20, 2024
1 parent 88731f9 commit 776d978
Show file tree
Hide file tree
Showing 67 changed files with 20 additions and 861,433 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ with YAML.
Improved language detection when one argument is a named pipe.

Updated to the latest tree-sitter parser for C, C++, C#, Haskell,
JavaScript, Objective-C, OCaml, Python, Ruby and Scala.
JavaScript, Objective-C, OCaml, Python, Ruby, Scala and TypeScript.

### Syntax Highlighting

Expand Down
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ tree-sitter-python = "0.23.5"
tree-sitter-cpp = "0.23.4"
tree-sitter-c = "0.23.4"
tree-sitter-javascript = "0.23.1"
tree-sitter-typescript = "0.23.2"

[dev-dependencies]
# assert_cmd 2.0.10 requires predicates 3.
Expand Down
10 changes: 0 additions & 10 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,6 @@ fn main() {
src_dir: "vendored_parsers/tree-sitter-toml-src",
extra_files: vec!["scanner.c"],
},
TreeSitterParser {
name: "tree-sitter-tsx",
src_dir: "vendored_parsers/tree-sitter-typescript-src/tsx/src",
extra_files: vec!["scanner.c"],
},
TreeSitterParser {
name: "tree-sitter-typescript",
src_dir: "vendored_parsers/tree-sitter-typescript-src/typescript/src",
extra_files: vec!["scanner.c"],
},
TreeSitterParser {
name: "tree-sitter-vhdl",
src_dir: "vendored_parsers/tree-sitter-vhdl-src",
Expand Down
20 changes: 7 additions & 13 deletions src/parse/tree_sitter_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ extern "C" {
fn tree_sitter_sql() -> ts::Language;
fn tree_sitter_swift() -> ts::Language;
fn tree_sitter_toml() -> ts::Language;
fn tree_sitter_tsx() -> ts::Language;
fn tree_sitter_typescript() -> ts::Language;
fn tree_sitter_vhdl() -> ts::Language;
fn tree_sitter_xml() -> ts::Language;
fn tree_sitter_yaml() -> ts::Language;
Expand Down Expand Up @@ -874,9 +872,7 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
let language = unsafe { tree_sitter_qmljs() };

let mut highlight_query = tree_sitter_javascript::HIGHLIGHT_QUERY.to_owned();
highlight_query.push_str(include_str!(
"../../vendored_parsers/highlights/typescript.scm"
));
highlight_query.push_str(tree_sitter_typescript::HIGHLIGHTS_QUERY);
highlight_query.push_str(include_str!("../../vendored_parsers/highlights/qmljs.scm"));

TreeSitterConfig {
Expand Down Expand Up @@ -1070,12 +1066,11 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
}
}
TypeScriptTsx => {
let language = unsafe { tree_sitter_tsx() };
let language_fn = tree_sitter_typescript::LANGUAGE_TSX;
let language = tree_sitter::Language::new(language_fn);

let mut highlight_query = tree_sitter_javascript::HIGHLIGHT_QUERY.to_owned();
highlight_query.push_str(include_str!(
"../../vendored_parsers/highlights/typescript.scm"
));
highlight_query.push_str(tree_sitter_typescript::HIGHLIGHTS_QUERY);

TreeSitterConfig {
language: language.clone(),
Expand All @@ -1086,12 +1081,11 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
}
}
TypeScript => {
let language = unsafe { tree_sitter_typescript() };
let language_fn = tree_sitter_typescript::LANGUAGE_TYPESCRIPT;
let language = tree_sitter::Language::new(language_fn);

let mut highlight_query = tree_sitter_javascript::HIGHLIGHT_QUERY.to_owned();
highlight_query.push_str(include_str!(
"../../vendored_parsers/highlights/typescript.scm"
));
highlight_query.push_str(tree_sitter_typescript::HIGHLIGHTS_QUERY);

TreeSitterConfig {
language: language.clone(),
Expand Down
1 change: 0 additions & 1 deletion vendored_parsers/highlights/typescript.scm

This file was deleted.

1 change: 0 additions & 1 deletion vendored_parsers/tree-sitter-typescript-src/common

This file was deleted.

1 change: 0 additions & 1 deletion vendored_parsers/tree-sitter-typescript-src/tsx

This file was deleted.

1 change: 0 additions & 1 deletion vendored_parsers/tree-sitter-typescript-src/typescript

This file was deleted.

20 changes: 0 additions & 20 deletions vendored_parsers/tree-sitter-typescript/.eslintrc.js

This file was deleted.

20 changes: 0 additions & 20 deletions vendored_parsers/tree-sitter-typescript/.gitattributes

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions vendored_parsers/tree-sitter-typescript/.github/workflows/ci.yml

This file was deleted.

19 changes: 0 additions & 19 deletions vendored_parsers/tree-sitter-typescript/.github/workflows/lint.yml

This file was deleted.

Loading

0 comments on commit 776d978

Please sign in to comment.