Skip to content

Commit ff5438c

Browse files
pepeiborraAilrun
andauthored
Fix a bad case of boolean blindness (#1265)
Co-authored-by: Junyoung/Clare Jang <jjc9310@gmail.com>
1 parent 3763832 commit ff5438c

File tree

1 file changed

+9
-2
lines changed
  • ghcide/src/Development/IDE/Plugin

1 file changed

+9
-2
lines changed

ghcide/src/Development/IDE/Plugin/HLS.hs

+9-2
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,17 @@ makeCompletions sps lf ideState params@(CompletionParams (TextDocumentIdentifier
472472
consumeCompletionResponse :: Int -> CompletionResponseResult -> (Int, CompletionResponseResult)
473473
consumeCompletionResponse limit it@(CompletionList (CompletionListType _ (List xx))) =
474474
case splitAt limit xx of
475+
-- consumed all the items, return the result as is
475476
(_, []) -> (limit - length xx, it)
476-
(xx', _) -> (0, CompletionList (CompletionListType False (List xx')))
477+
-- need to crop the response, set the 'isIncomplete' flag
478+
(xx', _) -> (0, CompletionList (CompletionListType isIncompleteResponse (List xx')))
477479
consumeCompletionResponse n (Completions (List xx)) =
478-
consumeCompletionResponse n (CompletionList (CompletionListType False (List xx)))
480+
consumeCompletionResponse n (CompletionList (CompletionListType isCompleteResponse (List xx)))
481+
482+
-- boolean disambiguators
483+
isCompleteResponse, isIncompleteResponse :: Bool
484+
isIncompleteResponse = True
485+
isCompleteResponse = False
479486

480487
getPrefixAtPos :: LSP.LspFuncs Config -> Uri -> Position -> IO (Maybe VFS.PosPrefixInfo)
481488
getPrefixAtPos lf uri pos = do

0 commit comments

Comments
 (0)