HomePhabricator

[clangd] Interfaces for writing code tweaks

Description

[clangd] Interfaces for writing code tweaks

Summary:
The code tweaks are an implementation of mini-refactorings exposed
via the LSP code actions. They run in two stages:

  • Stage 1. Decides whether the action is available to the user and collects all the information required to finish the action. Should be cheap, since this will run over all the actions known to clangd on each textDocument/codeAction request from the client.
  • Stage 2. Uses information from stage 1 to produce the actual edits that the code action should perform. This stage can be expensive and will only run if the user chooses to perform the specified action in the UI.

One unfortunate consequence of this change is increased latency of
processing the textDocument/codeAction requests, which now wait for an
AST. However, we cannot avoid this with what we have available in the LSP
today.

Reviewers: kadircet, ioeric, hokein, sammccall

Reviewed By: sammccall

Subscribers: mgrang, mgorny, MaskRay, jkorous, arphaman, cfe-commits

Differential Revision: https://reviews.llvm.org/D56267

Details

Committed
ibiryukovJan 29 2019, 6:17 AM
Reviewer
sammccall
Differential Revision
D56267: [clangd] Interfaces for writing code actions
Parents
rL352493: Merging r352459:
Branches
Unknown
Tags
Unknown