[all-commits] [llvm/llvm-project] 8adc4d: [clangd] Add textDocument/ast extension method to ...
Sam McCall via All-commits
all-commits at lists.llvm.org
Thu Nov 19 16:15:37 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 8adc4d1ec76471bc283d888f3077f7d8f591d6ad
https://github.com/llvm/llvm-project/commit/8adc4d1ec76471bc283d888f3077f7d8f591d6ad
Author: Sam McCall <sam.mccall at gmail.com>
Date: 2020-11-20 (Fri, 20 Nov 2020)
Changed paths:
M clang-tools-extra/clangd/CMakeLists.txt
M clang-tools-extra/clangd/ClangdLSPServer.cpp
M clang-tools-extra/clangd/ClangdLSPServer.h
M clang-tools-extra/clangd/ClangdServer.cpp
M clang-tools-extra/clangd/ClangdServer.h
A clang-tools-extra/clangd/DumpAST.cpp
A clang-tools-extra/clangd/DumpAST.h
M clang-tools-extra/clangd/Protocol.cpp
M clang-tools-extra/clangd/Protocol.h
A clang-tools-extra/clangd/test/ast.test
M clang-tools-extra/clangd/test/initialize-params.test
M clang-tools-extra/clangd/unittests/CMakeLists.txt
A clang-tools-extra/clangd/unittests/DumpASTTests.cpp
Log Message:
-----------
[clangd] Add textDocument/ast extension method to dump the AST
This is a mass-market version of the "dump AST" tweak we have behind
-hidden-features.
I think in this friendlier form it'll be useful for people outside clang
developers, which would justify making it a real feature.
It could be useful as a step towards lightweight clang-AST tooling in clangd
itself (like matcher-based search).
Advantages over the tweak:
- simplified information makes it more accessible, likely somewhat useful
without learning too much clang internals
- can be shown in a tree view
- structured information gives some options for presentation (e.g.
icon + two text colors + tooltip in vscode)
- clickable nodes jump to the corresponding code
Disadvantages:
- a bunch of code to handle different node types
- likely missing some important info vs dump-ast due to brevity/oversight
- may end up chasing/maintaining support for the long tail of nodes
Demo with VSCode support: https://imgur.com/a/6gKfyIV
Differential Revision: https://reviews.llvm.org/D89571
More information about the All-commits
mailing list