Skip to content

Commit

Permalink
Use tree-sitter-java from crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Dec 20, 2024
1 parent 80f0100 commit d2ed2f6
Show file tree
Hide file tree
Showing 56 changed files with 18 additions and 86,120 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ 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, Scala and TypeScript.
Java, 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 @@ -89,6 +89,7 @@ tree-sitter-cpp = "0.23.4"
tree-sitter-c = "0.23.4"
tree-sitter-javascript = "0.23.1"
tree-sitter-typescript = "0.23.2"
tree-sitter-java = "0.23.4"

[dev-dependencies]
# assert_cmd 2.0.10 requires predicates 3.
Expand Down
5 changes: 0 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,6 @@ fn main() {
src_dir: "vendored_parsers/tree-sitter-janet-simple-src",
extra_files: vec!["scanner.c"],
},
TreeSitterParser {
name: "tree-sitter-java",
src_dir: "vendored_parsers/tree-sitter-java-src",
extra_files: vec![],
},
TreeSitterParser {
name: "tree-sitter-json",
src_dir: "vendored_parsers/tree-sitter-json-src",
Expand Down
11 changes: 4 additions & 7 deletions src/parse/tree_sitter_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ extern "C" {
fn tree_sitter_hcl() -> ts::Language;
fn tree_sitter_html() -> ts::Language;
fn tree_sitter_janet_simple() -> ts::Language;
fn tree_sitter_java() -> ts::Language;
fn tree_sitter_json() -> ts::Language;
fn tree_sitter_julia() -> ts::Language;
fn tree_sitter_kotlin() -> ts::Language;
Expand Down Expand Up @@ -573,7 +572,8 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
}
}
Java => {
let language = unsafe { tree_sitter_java() };
let language_fn = tree_sitter_java::LANGUAGE;
let language = tree_sitter::Language::new(language_fn);
TreeSitterConfig {
language: language.clone(),
atom_nodes: vec![
Expand All @@ -594,11 +594,8 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
.into_iter()
.collect(),
delimiter_tokens: vec![("(", ")"), ("{", "}"), ("[", "]")],
highlight_query: ts::Query::new(
&language,
include_str!("../../vendored_parsers/highlights/java.scm"),
)
.unwrap(),
highlight_query: ts::Query::new(&language, tree_sitter_java::HIGHLIGHTS_QUERY)
.unwrap(),
sub_languages: vec![],
}
}
Expand Down
1 change: 0 additions & 1 deletion vendored_parsers/highlights/java.scm

This file was deleted.

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

This file was deleted.

2 changes: 0 additions & 2 deletions vendored_parsers/tree-sitter-java/.gitattributes

This file was deleted.

This file was deleted.

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

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions vendored_parsers/tree-sitter-java/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions vendored_parsers/tree-sitter-java/.npmignore

This file was deleted.

18 changes: 0 additions & 18 deletions vendored_parsers/tree-sitter-java/CMakeLists.txt

This file was deleted.

68 changes: 0 additions & 68 deletions vendored_parsers/tree-sitter-java/CONTRIBUTING.md

This file was deleted.

31 changes: 0 additions & 31 deletions vendored_parsers/tree-sitter-java/Cargo.toml

This file was deleted.

21 changes: 0 additions & 21 deletions vendored_parsers/tree-sitter-java/LICENSE

This file was deleted.

Loading

0 comments on commit d2ed2f6

Please sign in to comment.