Skip to content

Commit 8334f2c

Browse files
authored
Merge pull request #5676 from unisonweb/lsp/dot-completion
2 parents 95633d3 + 0c691be commit 8334f2c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

unison-cli/src/Unison/LSP/Completion.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,12 @@ completionHandler m respond =
6060
respond . maybe (Right $ InL mempty) (Right . InR . InL) =<< runMaybeT do
6161
let fileUri = (m ^. params . textDocument . uri)
6262
(range, prefix) <- VFS.completionPrefix (m ^. params . textDocument . uri) (m ^. params . position)
63+
-- dots are separators in names and a name with a trailing '.' doesn't parse and short-circuits completion.
64+
-- Since the completion overwrites the explicitly provided range anyways, stripping just works better.
65+
let strippedPrefix = Text.dropWhileEnd (== '.') prefix
6366
ppe <- PPED.suffixifiedPPE <$> lift currentPPED
6467
codebaseCompletions <- lift getCodebaseCompletions
65-
let (isIncomplete, matches) = completionsForQuery codebaseCompletions prefix
68+
let (isIncomplete, matches) = completionsForQuery codebaseCompletions strippedPrefix
6669
let defCompletionItems =
6770
matches
6871
& mapMaybe \(path, fqn, dep) ->

0 commit comments

Comments
 (0)