haskell / haskell/haskell-language-server

Use AnnotatedTextEdits throughout HLS

Open
#3,210 6 comments 0 reactions 1 assignee Claimed by @nilsalex View on GitHub
type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.