Skip to content

Commit

Permalink
Use tree-sitter-html from crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfred committed Dec 20, 2024
1 parent 507b60b commit 4873e87
Show file tree
Hide file tree
Showing 35 changed files with 18 additions and 4,652 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 Bash, C, C++, C#, Go,
Haskell, Java, JavaScript, JSON, Julia, Objective-C, OCaml, PHP,
Haskell, HTML, 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 @@ -95,6 +95,7 @@ tree-sitter-go = "0.23.4"
tree-sitter-bash = "0.23.3"
tree-sitter-php = "0.23.11"
tree-sitter-json = "0.24.8"
tree-sitter-html = "0.23.2"

[dev-dependencies]
# assert_cmd 2.0.10 requires predicates 3.
Expand Down
7 changes: 0 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ impl TreeSitterParser {
.flag_if_supported("-Wno-implicit-fallthrough")
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wno-ignored-qualifiers")
// Ignore warning from tree-sitter-html.
.flag_if_supported("-Wno-sign-compare")
.link_lib_modifier("+whole-archive");

for file in cpp_files {
Expand Down Expand Up @@ -154,11 +152,6 @@ fn main() {
src_dir: "vendored_parsers/tree-sitter-hcl-src",
extra_files: vec!["scanner.cc"],
},
TreeSitterParser {
name: "tree-sitter-html",
src_dir: "vendored_parsers/tree-sitter-html-src",
extra_files: vec!["scanner.cc"],
},
TreeSitterParser {
name: "tree-sitter-janet-simple",
src_dir: "vendored_parsers/tree-sitter-janet-simple-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 @@ -79,7 +79,6 @@ extern "C" {
fn tree_sitter_hare() -> ts::Language;
fn tree_sitter_hack() -> ts::Language;
fn tree_sitter_hcl() -> ts::Language;
fn tree_sitter_html() -> ts::Language;
fn tree_sitter_janet_simple() -> ts::Language;
fn tree_sitter_kotlin() -> ts::Language;
fn tree_sitter_latex() -> ts::Language;
Expand Down Expand Up @@ -507,7 +506,9 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
}
}
Html => {
let language = unsafe { tree_sitter_html() };
let language_fn = tree_sitter_html::LANGUAGE;
let language = tree_sitter::Language::new(language_fn);

TreeSitterConfig {
language: language.clone(),
atom_nodes: vec![
Expand All @@ -522,11 +523,8 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
delimiter_tokens: vec![("<", ">"), ("<!", ">"), ("<!--", "-->")]
.into_iter()
.collect(),
highlight_query: ts::Query::new(
&language,
include_str!("../../vendored_parsers/highlights/html.scm"),
)
.unwrap(),
highlight_query: ts::Query::new(&language, tree_sitter_html::HIGHLIGHTS_QUERY)
.unwrap(),
sub_languages: vec![
TreeSitterSubLanguage {
query: ts::Query::new(&language, "(style_element (raw_text) @contents)")
Expand Down
1 change: 0 additions & 1 deletion vendored_parsers/tree-sitter-html-src

This file was deleted.

22 changes: 0 additions & 22 deletions vendored_parsers/tree-sitter-html/.appveyor.yml

This file was deleted.

1 change: 0 additions & 1 deletion vendored_parsers/tree-sitter-html/.gitattributes

This file was deleted.

12 changes: 0 additions & 12 deletions vendored_parsers/tree-sitter-html/.gitignore

This file was deleted.

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

This file was deleted.

10 changes: 0 additions & 10 deletions vendored_parsers/tree-sitter-html/.travis.yml

This file was deleted.

25 changes: 0 additions & 25 deletions vendored_parsers/tree-sitter-html/Cargo.toml

This file was deleted.

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

This file was deleted.

99 changes: 0 additions & 99 deletions vendored_parsers/tree-sitter-html/Makefile

This file was deleted.

13 changes: 0 additions & 13 deletions vendored_parsers/tree-sitter-html/README.md

This file was deleted.

19 changes: 0 additions & 19 deletions vendored_parsers/tree-sitter-html/binding.gyp

This file was deleted.

16 changes: 0 additions & 16 deletions vendored_parsers/tree-sitter-html/bindings/c/tree-sitter.h.in

This file was deleted.

11 changes: 0 additions & 11 deletions vendored_parsers/tree-sitter-html/bindings/c/tree-sitter.pc.in

This file was deleted.

28 changes: 0 additions & 28 deletions vendored_parsers/tree-sitter-html/bindings/node/binding.cc

This file was deleted.

Loading

0 comments on commit 4873e87

Please sign in to comment.