- Found function like “show interested AST node” in source code , when will
it be available for vscode ? personally it is rather helpful.
2 tried many times but clangd.trace.json is reported bad formatted by chrome tracing
I’m not sure what you’re referring to. Could you link to it?
i guess the user means actions we have in
clang-tools-extra/clangd/refactor/tweaks/DumpAST.cpp, they can be turned on by passing
--hidden-features to clangd.
tried many times but clangd.trace.json is reported bad formatted by chrome tracing
you need to make sure clangd is shutdown gracefully, as certain terminators are only emitted during destruction of the tracer.
in fact , using vscode im not sure whether it exits or terminated , i just shutdown vscode .
no help message for setting trace file as an argument otherwise trace can be used with --check
It seems to be semantic selection
additional question : will a clang-query like function be added to clangd in the future ?
The code in this file implements two features, both of which are supported in VSCode:
- Selection ranges, this allows selecting the AST node enclosing the cursor, this is done in VSCode using the Expand Selection command.
Folding ranges, which allows collapsing a block of code such as a function body. This can be done in VSCode with the arrows that show up next to the line numbers if the
"editor.folding"setting is enabled.
Based on https://devblogs.microsoft.com/cppblog/exploring-clang-tooling-part-2-examining-the-clang-ast-with-clang-query/,
clang-query seems to be a tool for interactively running an AST matcher on a code file.
Are you looking for a way to run an AST matcher on all the files in a project?
If so, clangd wouldn’t help with making this any faster than just running
clang-query itself on all the source files in the project. The reason is that AST matchers need to run on an AST, and clangd’s index does not store ASTs of the source files in the project, it stores a database of information that’s smaller and more tailored to the operations that clangd supports, than ASTs would be.
If you’re looking to query clangd’s index database for information it does contain (instead of running AST matchers), you might find GitHub - frabert/ClangQL: Query C++ codebases using SQLite interesting.
Not sure if this is what you mean, but I found some time to try an interactive clang-query like feature that I’d been wondering about for years
selection ranges is very useful , thank you for your enlightment.
yes it is what i mean