[clangd] Add Macro Expansion to Hover
This patch adds macro expansion preview to hover info. Basically, the refactor infrastructure for expanding macro is used for this purpose. The following steps are added to getHoverContents for macros: 1. calling AST.getTokens().expansionStartingAt(...) to get expanded tokens 2. calling reformat(...) to format expanded tokens Some opinions are wanted: 1. Should we present macro expansion before definition in the hover card? 2. Should we truncate/ignore macro expansion if it's too long? For performance and presentation reason, it might not be a good idea to expand pages worth of tokens in hover card. If so, what's the preferred threshold? Also, some limitation applies: 1. Expansion isn't available in macro definition/arguments as the refactor code action isn't either. Differential Revision: https://reviews.llvm.org/D127082
Loading
Please sign in to comment