Description
AnnotatedTextEdit
s are a feature of the LSP spec that allow more structured edits to be returned. In particular:
- Multiple edits can be associated with a single annotation
- The annotation can have a name and a description
- The annotation can also indicate that the edit requires confirmation from the user
I haven't tested out what this looks like in the client, but in principle this should allow much nicer communication of what's going on with edits. For example, when adding imports for completions, we can annotate the edits for modifying imports to say what we're doing. The confirmation feature (if it actually works) seems nice for questionable or wide-ranging edits, like for renaming across modules.
We should try using them!
A good place to start would be here: https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs#L202, which sends a message to the user to tell them what we did. Hopefully an AnnotatedTextEdit
would do that job better.