Some updates to the sub crates

This commit is contained in:
Silas Marvin
2024-08-05 20:38:52 -07:00
parent 8efa75af93
commit 09a098c50a
5 changed files with 62 additions and 5 deletions

2
Cargo.lock generated
View File

@@ -1566,7 +1566,7 @@ dependencies = [
[[package]] [[package]]
name = "lsp-ai" name = "lsp-ai"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"assert_cmd", "assert_cmd",

View File

@@ -16,4 +16,4 @@ tree-sitter-rust = "0.21"
tree-sitter-zig = { git = "https://github.com/maxxnino/tree-sitter-zig" } tree-sitter-zig = { git = "https://github.com/maxxnino/tree-sitter-zig" }
[build-dependencies] [build-dependencies]
cc="*" cc="1"

View File

@@ -30,8 +30,26 @@ tree-sitter-rust = { version = "0.21", optional = true }
# tree-sitter-zig = { git = "https://github.com/maxxnino/tree-sitter-zig", optional = true } # tree-sitter-zig = { git = "https://github.com/maxxnino/tree-sitter-zig", optional = true }
[build-dependencies] [build-dependencies]
cc="*" cc="1"
[features] [features]
default = [] default = []
all = ["dep:tree-sitter-python", "dep:tree-sitter-bash", "dep:tree-sitter-c", "dep:tree-sitter-cpp", "dep:tree-sitter-c-sharp", "dep:tree-sitter-css", "dep:tree-sitter-elixir", "dep:tree-sitter-erlang", "dep:tree-sitter-go", "dep:tree-sitter-html", "dep:tree-sitter-java", "dep:tree-sitter-javascript", "dep:tree-sitter-json", "dep:tree-sitter-rust", "dep:tree-sitter-haskell", "dep:tree-sitter-lua", "dep:tree-sitter-ocaml"] all = ["python", "bash", "c", "cpp", "csharp", "css", "elixir", "erlang", "go", "html", "java", "javascript", "json", "rust", "haskell", "lua", "ocaml"]
python = ["dep:tree-sitter-python"]
bash = ["dep:tree-sitter-bash"]
c = ["dep:tree-sitter-c"]
cpp = ["dep:tree-sitter-cpp"]
csharp = ["dep:tree-sitter-c-sharp"]
css = ["dep:tree-sitter-css"]
elixir = ["dep:tree-sitter-elixir"]
erlang = ["dep:tree-sitter-erlang"]
go = ["dep:tree-sitter-go"]
html = ["dep:tree-sitter-html"]
java = ["dep:tree-sitter-java"]
javascript = ["dep:tree-sitter-javascript"]
json = ["dep:tree-sitter-json"]
rust = ["dep:tree-sitter-rust"]
haskell = ["dep:tree-sitter-haskell"]
lua = ["dep:tree-sitter-lua"]
ocaml = ["dep:tree-sitter-ocaml"]

View File

@@ -0,0 +1,39 @@
!C I currently have the following in my Cargo.toml
[features]
default = []
all = ["dep:tree-sitter-python", "dep:tree-sitter-bash", "dep:tree-sitter-c", "dep:tree-sitter-cpp", "dep:tree-sitter-c-sharp", "dep:tree-sitter-css", "dep:tree-sitter-elixir", "dep:tree-sitter-erlang", "dep:tree-sitter-go", "dep:tree-sitter-html", "dep:tree-sitter-java", "dep:tree-sitter-javascript", "dep:tree-sitter-json", "dep:tree-sitter-rust", "dep:tree-sitter-haskell", "dep:tree-sitter-lua", "dep:tree-sitter-ocaml"]
Update the features to include a feature for each language that activates its relevant dependency
<|assistant|>
Here's how you can update your `Cargo.toml` to include a feature for each language that activates its relevant dependency:
```toml
[features]
default = []
all = ["python", "bash", "c", "cpp", "csharp", "css", "elixir", "erlang", "go", "html", "java", "javascript", "json", "rust", "haskell", "lua", "ocaml"]
python = ["dep:tree-sitter-python"]
bash = ["dep:tree-sitter-bash"]
c = ["dep:tree-sitter-c"]
cpp = ["dep:tree-sitter-cpp"]
csharp = ["dep:tree-sitter-c-sharp"]
css = ["dep:tree-sitter-css"]
elixir = ["dep:tree-sitter-elixir"]
erlang = ["dep:tree-sitter-erlang"]
go = ["dep:tree-sitter-go"]
html = ["dep:tree-sitter-html"]
java = ["dep:tree-sitter-java"]
javascript = ["dep:tree-sitter-javascript"]
json = ["dep:tree-sitter-json"]
rust = ["dep:tree-sitter-rust"]
haskell = ["dep:tree-sitter-haskell"]
lua = ["dep:tree-sitter-lua"]
ocaml = ["dep:tree-sitter-ocaml"]
```
This setup allows you to enable individual language support or use the `all` feature to enable all languages at once.
<|user|>

View File

@@ -56,7 +56,7 @@ pub fn get_parser_for_extension(extension: &str) -> Result<Parser, GetParserErro
"C" => parser.set_language(&tree_sitter_c::language())?, "C" => parser.set_language(&tree_sitter_c::language())?,
#[cfg(any(feature = "all", feature = "cpp"))] #[cfg(any(feature = "all", feature = "cpp"))]
"C++" => parser.set_language(&tree_sitter_cpp::language())?, "C++" => parser.set_language(&tree_sitter_cpp::language())?,
#[cfg(any(feature = "all", feature = "c-sharp"))] #[cfg(any(feature = "all", feature = "csharp"))]
"C#" => parser.set_language(&tree_sitter_c_sharp::language())?, "C#" => parser.set_language(&tree_sitter_c_sharp::language())?,
#[cfg(any(feature = "all", feature = "css"))] #[cfg(any(feature = "all", feature = "css"))]
"CSS" => parser.set_language(&tree_sitter_css::language())?, "CSS" => parser.set_language(&tree_sitter_css::language())?,