Skip to content

Commit

Permalink
feat: Add support for C/C++
Browse files Browse the repository at this point in the history
Add support for C/C++ by relying on tree-sitter-c and tree-sitter-cpp
respectively.
  • Loading branch information
dheeraj-reddy-ts committed Nov 20, 2023
1 parent 4c99ae9 commit 533a3b1
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 3 deletions.
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions crates/tabby-common/assets/languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,40 @@ top_level_keywords = [
"rescue",
"self",
]

[[config]]
languages = ["c"]
line_comment = "//"
top_level_keywords = [
"const",
"enum",
"extern",
"inline",
"register",
"static",
"struct",
"typedef",
"union",
"volatile",
]

[[config]]
languages = ["cpp"]
line_comment = "//"
top_level_keywords = [
"auto",
"class",
"const",
"concept",
"enum",
"extern",
"inline",
"namespace",
"register",
"static",
"struct",
"template",
"typedef",
"union",
"volatile",
]
4 changes: 3 additions & 1 deletion crates/tabby-scheduler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ tree-sitter-java = "0.20.2"
tree-sitter-rust = "0.20.3"
tree-sitter-typescript = "0.20.3"
tree-sitter-go = "0.20.0"
tree-sitter-ruby= "0.20.0"
tree-sitter-ruby = "0.20.0"
tree-sitter-c = { git = "https://github.com/tree-sitter/tree-sitter-c/", rev = "212a80f" }
tree-sitter-cpp = { git = "https://github.com/tree-sitter/tree-sitter-cpp", rev = "a714740" }
ignore = "0.4.20"
kdam = { version = "0.5.0" }
requirements = "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/tabby-scheduler/src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ lazy_static! {
("csharp", vec!["cs"]),
(
"cpp",
vec!["cpp", "hpp", "c++", "h++", "cc", "hh", "C", "H"],
vec!["cpp", "hpp", "c++", "h++", "cc", "hh", "C", "H", "tcc"],
),
("css", vec!["css"]),
("dockerfile", vec!["Dockerfile"]),
Expand Down
22 changes: 22 additions & 0 deletions crates/tabby-scheduler/src/dataset/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,28 @@ lazy_static! {
.unwrap(),
),
),
(
"c",
TagsConfigurationSync(
TagsConfiguration::new(
tree_sitter_c::language(),
tree_sitter_c::TAGS_QUERY,
"",
)
.unwrap(),
),
),
(
"cpp",
TagsConfigurationSync(
TagsConfiguration::new(
tree_sitter_cpp::language(),
tree_sitter_cpp::TAGS_QUERY,
"",
)
.unwrap(),
),
),
])
};
}
1 change: 0 additions & 1 deletion website/docs/programming-languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ For an actual example of an issue or pull request adding the above support, plea

| Language | Stop Words (time to contribute: <5 min) | Repository Context (time to contribute: <1 hr) |
| :------: | :-------------------------------------: | :--------------------------------------------: |
| C/C++ | 🚫 | 🚫 |
| C# | 🚫 | 🚫 |
| CSS | 🚫 | 🚫 |
| Haskell | 🚫 | 🚫 |
Expand Down

0 comments on commit 533a3b1

Please sign in to comment.