Skip to content

Commit d89c97e

Browse files
committed
add an example
1 parent bae0ad7 commit d89c97e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: ghcide/src/Development/IDE/Plugin/Completions.hs

+17
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,23 @@ getCompletionsLSP ide plId
173173
To allow the LSP client to reorder identifiers while preserving the relative ordering
174174
of repeated occurrences we generate sortText values that include both the label and
175175
an index denoting the relative order
176+
177+
EXAMPLE
178+
We produce completions:
179+
x -- local
180+
y -- local
181+
x -- global
182+
y -- global
183+
184+
The LSP client decides to present:
185+
y -- local
186+
y -- global
187+
x -- local
188+
x -- global
189+
190+
This is fine if the LSP client thinks that 'y' is more relevant than 'x'.
191+
We are OK with that choice since the local options are presented before the global ones
192+
176193
-}
177194
orderedCompletions :: [CompletionItem] -> [CompletionItem]
178195
orderedCompletions = zipWith addOrder [0..]

0 commit comments

Comments
 (0)