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:
- calling AST.getTokens().expansionStartingAt(...) to get expanded tokens
- calling reformat(...) to format expanded tokens
Some opinions are wanted:
- Should we present macro expansion before definition in the hover card?
- 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:
- Expansion isn't available in macro definition/arguments as the refactor code action isn't either.
I think the ruler + paragraph header might appear too heavyweight, would need to take a look.
I think we're missing tests for present().
(If this can become part of the definition, then no need for new tests)