tree-sitter-cpp
tree-sitter-c
| tree-sitter-cpp | tree-sitter-c | |
|---|---|---|
| 8 | 8 | |
| 387 | 328 | |
| 2.6% | 3.4% | |
| 7.4 | 5.7 | |
| 28 days ago | 28 days ago | |
| JavaScript | JavaScript | |
| MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
tree-sitter-cpp
- Difftastic, a structural diff tool that understands syntax
Grammar page (https://github.com/tree-sitter/tree-sitter-cpp) reference two documents at the very end:
- Hyperlinked C++ BNF Grammar (https://alx71hub.github.io/hcb/)
- EBNF Syntax: C++ (ISO/IEC 14882:1998(E)) https://www.externsoft.ch/download/cpp-iso.html
The second doc has a year in the title, so it's ancient af.
- How to Get Started with Tree-Sitter
- Emacs and Java Development: Corfu + Cape + LSP-Mode + Treesit
- GitHub code search is generally available
The feature isn't working well yet on C and C++. If I recall correctly it's based on Tree-Sitter[1] parsing, and there are still too many bugs in corresponding grammars - tree-sitter-c[2] and tree-sitter-cpp[3]. Hopefully, it will be greatly improved in the future as the share of the existing and newly written code in C and C++ is quite significant.
[1] https://tree-sitter.github.io/tree-sitter/
[2] https://github.com/tree-sitter/tree-sitter-c/issues
[3] https://github.com/tree-sitter/tree-sitter-cpp/issues
- Building tree-sitter languages for Emacs
- Call for volunteers: add tree-sitter support to major modes
There's treesitter-cpp parser that works to some extent already. However, for complex language like c++, I think it would be better to use lsp's semantic highlighting instead
- Neovim C++ development
- Difftastic: A syntactic diff tool
C++ is currently unsupported, but there's a good tree-sitter implementation I can add: https://github.com/tree-sitter/tree-sitter-cpp
tree-sitter-c
- Show HN: Globstar – Open-source static analysis toolkit
Supporting C / C++ is in our roadmap. It needs some additional work to handle preprocessor directives [1] [2], which is why we didn't focus on it for the initial release.
[1] https://github.com/tree-sitter/tree-sitter-c/issues/13
[2] https://github.com/tree-sitter/tree-sitter-c/issues/108
- How to Get Started with Tree-Sitter
- Emacs and Java Development: Corfu + Cape + LSP-Mode + Treesit
- GitHub code search is generally available
The feature isn't working well yet on C and C++. If I recall correctly it's based on Tree-Sitter[1] parsing, and there are still too many bugs in corresponding grammars - tree-sitter-c[2] and tree-sitter-cpp[3]. Hopefully, it will be greatly improved in the future as the share of the existing and newly written code in C and C++ is quite significant.
[1] https://tree-sitter.github.io/tree-sitter/
[2] https://github.com/tree-sitter/tree-sitter-c/issues
[3] https://github.com/tree-sitter/tree-sitter-cpp/issues
- Indent 8 spaces
[[language]] name = "c" scope = "source.c" injection-regex = "c" file-types = ["c"] # TODO: ["h"] roots = [] comment-token = "//" language-server = { command = "clangd" } indent = { tab-width = 8, unit = " " } [language.debugger] name = "lldb-vscode" transport = "stdio" command = "lldb-vscode" [[language.debugger.templates]] name = "binary" request = "launch" completion = [ { name = "binary", completion = "filename" } ] args = { console = "internalConsole", program = "{0}" } [[language.debugger.templates]] name = "attach" request = "attach" completion = [ "pid" ] args = { console = "internalConsole", pid = "{0}" } [[language.debugger.templates]] name = "gdbserver attach" request = "attach" completion = [ { name = "lldb connect url", default = "connect://localhost:3333" }, { name = "file", completion = "filename" }, "pid" ] args = { console = "internalConsole", attachCommands = [ "platform select remote-gdb-server", "platform connect {0}", "file {1}", "attach {2}" ] } [[grammar]] name = "c" source = { git = "https://github.com/tree-sitter/tree-sitter-c", rev = "7175a6dd5fc1cee660dce6fe23f6043d75af424a" }
- Building tree-sitter languages for Emacs
- treesitter printf format highlighting?
There's no way to highlight format specs currently, since the treesitter C grammar doesn't specify them. You could open an issue on the tree-sitter-c repo.
- Tree-sitter: an incremental parsing system for programming tools
[1] https://github.com/tree-sitter/tree-sitter-c/issues/51
What are some alternatives?
difftastic - a structural diff that understands syntax 🟥🟩
csharp-mode - A major-mode for editing C# in emacs
git-split-diffs - Syntax highlighted side-by-side diffs in your terminal
tree-sitter-rust - Rust grammar for tree-sitter
tree-sitter-typescript - TypeScript grammar for tree-sitter
tree-sitter-kotlin - Kotlin grammar for Tree-sitter