File tree Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Expand file tree Collapse file tree 2 files changed +7
-15
lines changed Original file line number Diff line number Diff line change 11import { fileURLToPath } from "url" ;
22import { RequestMessage } from "vscode-languageserver" ;
3+ import { CompletionItem } from "vscode-languageserver-protocol" ;
34import * as utils from "./utils" ;
45import * as path from "path" ;
56import { execFileSync } from "child_process" ;
@@ -60,11 +61,11 @@ export function runDumpCommand(msg: RequestMessage): dumpCommandResult | null {
6061 }
6162}
6263
63- type completionCommandResult = [ { label : string } ] ;
64+ // TODO: the result will never be null soon when the updated binary syncs
6465export function runCompletionCommand (
6566 msg : RequestMessage ,
6667 code : string
67- ) : completionCommandResult | null {
68+ ) : CompletionItem [ ] | null {
6869 let executable = findExecutable ( msg . params . textDocument . uri ) ;
6970 if ( executable == null ) {
7071 return null ;
Original file line number Diff line number Diff line change @@ -385,22 +385,13 @@ function onMessage(msg: m.Message) {
385385 send ( emptyDefinitionResponse ) ;
386386 }
387387 } else if ( msg . method === p . CompletionRequest . method ) {
388- let emptyCompletionResponse : m . ResponseMessage = {
388+ let code = getOpenedFileContent ( msg . params . textDocument . uri ) ;
389+ let completionResponse : m . ResponseMessage = {
389390 jsonrpc : c . jsonrpcVersion ,
390391 id : msg . id ,
391- result : null ,
392+ result : runCompletionCommand ( msg , code ) ,
392393 } ;
393- let code = getOpenedFileContent ( msg . params . textDocument . uri ) ;
394- let result = runCompletionCommand ( msg , code ) ;
395- if ( result === null ) {
396- send ( emptyCompletionResponse ) ;
397- } else {
398- let definitionResponse : m . ResponseMessage = {
399- ...emptyCompletionResponse ,
400- result : result ,
401- } ;
402- send ( definitionResponse ) ;
403- }
394+ send ( completionResponse ) ;
404395 } else if ( msg . method === p . DocumentFormattingRequest . method ) {
405396 // technically, a formatting failure should reply with the error. Sadly
406397 // the LSP alert box for these error replies sucks (e.g. doesn't actually
You can’t perform that action at this time.
0 commit comments