feat: Use custom version of tree-sitter-rust

Not much development is happening in that plugin.
This commit is contained in:
Lucas Schwiderski 2023-04-21 21:35:22 +02:00
parent c97e22fedb
commit fe69041113
Signed by: lucas
GPG key ID: AA12679AAA6DF4D8
5 changed files with 12 additions and 5 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "tree-sitter-rust"]
path = tree-sitter-rust
url = git@github.com:sclu1034/tree-sitter-rust.git

2
Cargo.lock generated
View file

@ -1086,8 +1086,6 @@ dependencies = [
[[package]] [[package]]
name = "tree-sitter-rust" name = "tree-sitter-rust"
version = "0.20.3" version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "797842733e252dc11ae5d403a18060bf337b822fc2ae5ddfaa6ff4d9cc20bda6"
dependencies = [ dependencies = [
"cc", "cc",
"tree-sitter", "tree-sitter",

View file

@ -1,6 +1,5 @@
[package] [package]
name = "kak-highlight" name = "kak-highlight"
author = "Lucas Schwiderski"
description = "Tree-sitter-based highlighting for Kakoune" description = "Tree-sitter-based highlighting for Kakoune"
version = "1.0.0" version = "1.0.0"
edition = "2021" edition = "2021"
@ -19,7 +18,7 @@ tracing-error = "0.2.0"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
tree-sitter = "0.20.10" tree-sitter = "0.20.10"
tree-sitter-highlight = "0.20.1" tree-sitter-highlight = "0.20.1"
tree-sitter-rust = "0.20.3" tree-sitter-rust = { path = "./tree-sitter-rust", version = "*" }
[dev-dependencies] [dev-dependencies]
criterion = "0.4.0" criterion = "0.4.0"

View file

@ -241,7 +241,13 @@ pub fn highlight_content(
} }
let highlights = highlighter let highlights = highlighter
.highlight(highlight_config, content, None, |_| None) .highlight(highlight_config, content, None, |lang| {
if lang == "rust" {
Some(highlight_config)
} else {
None
}
})
.wrap_err("Failed to highlight content")?; .wrap_err("Failed to highlight content")?;
let mut stack = VecDeque::with_capacity(64); let mut stack = VecDeque::with_capacity(64);

1
tree-sitter-rust Submodule

@ -0,0 +1 @@
Subproject commit 5dcc1e3df8cdce5365b65dac4692e350a2c396e5