Skip to content

Commit

Permalink
add an example
Browse files Browse the repository at this point in the history
  • Loading branch information
pepeiborra committed Nov 6, 2021
1 parent 0026fd8 commit 6568b3c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ghcide/src/Development/IDE/Plugin/Completions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,23 @@ getCompletionsLSP ide plId
To allow the LSP client to reorder identifiers while preserving the relative ordering
of repeated occurrences we generate sortText values that include both the label and
an index denoting the relative order
EXAMPLE
We produce completions:
x -- local
y -- local
x -- global
y -- global
The LSP client decides to present:
y -- local
y -- global
x -- local
x -- global
This is fine if the LSP client thinks that 'y' is more relevant than 'x'.
We are OK with that choice since the local options are presented before the global ones
-}
orderedCompletions :: [CompletionItem] -> [CompletionItem]
orderedCompletions = zipWith addOrder [0..]
Expand Down

0 comments on commit 6568b3c

Please sign in to comment.