Skip to content

Commit

Permalink
Use tree-sitter-json from crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Dec 20, 2024
1 parent d9e9b87 commit 507b60b
Show file tree
Hide file tree
Showing 36 changed files with 19 additions and 2,999 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ with YAML.
Improved language detection when one argument is a named pipe.

Updated to the latest tree-sitter parser for Bash, C, C++, C#, Go,
Haskell, Java, JavaScript, Julia, Objective-C, OCaml, PHP, Python, Ruby,
Scala and TypeScript.
Haskell, Java, JavaScript, JSON, Julia, Objective-C, OCaml, PHP,
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 @@ -94,6 +94,7 @@ tree-sitter-julia = "0.23.1"
tree-sitter-go = "0.23.4"
tree-sitter-bash = "0.23.3"
tree-sitter-php = "0.23.11"
tree-sitter-json = "0.24.8"

[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 @@ -164,11 +164,6 @@ fn main() {
src_dir: "vendored_parsers/tree-sitter-janet-simple-src",
extra_files: vec!["scanner.c"],
},
TreeSitterParser {
name: "tree-sitter-json",
src_dir: "vendored_parsers/tree-sitter-json-src",
extra_files: vec![],
},
TreeSitterParser {
name: "tree-sitter-kotlin",
src_dir: "vendored_parsers/tree-sitter-kotlin-src",
Expand Down
12 changes: 5 additions & 7 deletions src/parse/tree_sitter_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,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_json() -> ts::Language;
fn tree_sitter_kotlin() -> ts::Language;
fn tree_sitter_latex() -> ts::Language;
fn tree_sitter_lua() -> ts::Language;
Expand Down Expand Up @@ -617,16 +616,15 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
}
}
Json => {
let language = unsafe { tree_sitter_json() };
let language_fn = tree_sitter_json::LANGUAGE;
let language = tree_sitter::Language::new(language_fn);

TreeSitterConfig {
language: language.clone(),
atom_nodes: vec!["string"].into_iter().collect(),
delimiter_tokens: vec![("{", "}"), ("[", "]")],
highlight_query: ts::Query::new(
&language,
include_str!("../../vendored_parsers/highlights/json.scm"),
)
.unwrap(),
highlight_query: ts::Query::new(&language, tree_sitter_json::HIGHLIGHTS_QUERY)
.unwrap(),
sub_languages: vec![],
}
}
Expand Down
1 change: 0 additions & 1 deletion vendored_parsers/highlights/json.scm

This file was deleted.

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

This file was deleted.

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

This file was deleted.

10 changes: 0 additions & 10 deletions vendored_parsers/tree-sitter-json/.gitattributes

This file was deleted.

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

This file was deleted.

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

This file was deleted.

103 changes: 0 additions & 103 deletions vendored_parsers/tree-sitter-json/.github/workflows/publish.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vendored_parsers/tree-sitter-json/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions vendored_parsers/tree-sitter-json/.npmignore

This file was deleted.

24 changes: 0 additions & 24 deletions vendored_parsers/tree-sitter-json/Cargo.toml

This file was deleted.

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

This file was deleted.

Loading

0 comments on commit 507b60b

Please sign in to comment.