File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,10 @@ getCompletionsLSP
22
22
-> IdeState
23
23
-> CompletionParams
24
24
-> IO CompletionResponseResult
25
- getCompletionsLSP lsp ide CompletionParams {_textDocument= TextDocumentIdentifier uri,_position= position} = do
25
+ getCompletionsLSP lsp ide
26
+ CompletionParams {_textDocument= TextDocumentIdentifier uri
27
+ ,_position= position
28
+ ,_context= completionContext} = do
26
29
contents <- LSP. getVirtualFileFunc lsp $ toNormalizedUri uri
27
30
case (contents, uriToFilePath' uri) of
28
31
(Just cnts, Just path) -> do
@@ -32,8 +35,10 @@ getCompletionsLSP lsp ide CompletionParams{_textDocument=TextDocumentIdentifier
32
35
Just ((cci', tm'), mapping) -> do
33
36
let position' = fromCurrentPosition mapping position
34
37
pfix <- maybe (return Nothing ) (flip VFS. getCompletionPrefix cnts) position'
35
- case pfix of
36
- Just pfix' -> do
38
+ case (pfix, completionContext) of
39
+ (Just (VFS. PosPrefixInfo _ " " _ _), Just CompletionContext { _triggerCharacter = Just " ." })
40
+ -> return (Completions $ List [] )
41
+ (Just pfix', _) -> do
37
42
let fakeClientCapabilities = ClientCapabilities Nothing Nothing Nothing Nothing
38
43
Completions . List <$> getCompletions ideOpts cci' (tmrModule tm') pfix' fakeClientCapabilities (WithSnippets True )
39
44
_ -> return (Completions $ List [] )
Original file line number Diff line number Diff line change @@ -206,6 +206,7 @@ data Message
206
206
modifyOptions :: LSP. Options -> LSP. Options
207
207
modifyOptions x = x{ LSP. textDocumentSync = Just $ tweakTDS origTDS
208
208
, LSP. executeCommandCommands = Just [" typesignature.add" ]
209
+ , LSP. completionTriggerCharacters = Just " ."
209
210
}
210
211
where
211
212
tweakTDS tds = tds{_openClose= Just True , _change= Just TdSyncIncremental , _save= Just $ SaveOptions Nothing }
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ initializeResponseTests = withResource acquire release tests where
67
67
testGroup " initialize response capabilities"
68
68
[ chk " text doc sync" _textDocumentSync tds
69
69
, chk " hover" _hoverProvider (Just True )
70
- , chk " completion" _completionProvider (Just $ CompletionOptions (Just False ) Nothing Nothing )
70
+ , chk " completion" _completionProvider (Just $ CompletionOptions (Just False ) ( Just [ " . " ]) Nothing )
71
71
, chk " NO signature help" _signatureHelpProvider Nothing
72
72
, chk " goto definition" _definitionProvider (Just True )
73
73
, chk " NO goto type definition" _typeDefinitionProvider (Just $ GotoOptionsStatic False )
You can’t perform that action at this time.
0 commit comments