File tree Expand file tree Collapse file tree 2 files changed +20
-15
lines changed
Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -6,22 +6,21 @@ import { exec } from "child_process";
66import * as tmp from "tmp" ;
77import fs from "fs" ;
88
9+ let binaryPath = path . join (
10+ path . dirname ( __dirname ) ,
11+ process . platform ,
12+ "bin.exe"
13+ ) ;
14+
15+ export let binaryExists = fs . existsSync ( binaryPath ) ;
16+
917let findExecutable = ( uri : string ) => {
1018 let filePath = fileURLToPath ( uri ) ;
1119 let projectRootPath = utils . findProjectRootOfFile ( filePath ) ;
12- if ( projectRootPath == null ) {
20+ if ( projectRootPath == null || ! binaryExists ) {
1321 return null ;
1422 } else {
15- let binaryPath = path . join (
16- path . dirname ( __dirname ) ,
17- process . platform ,
18- "bin.exe"
19- ) ;
20- if ( fs . existsSync ( binaryPath ) ) {
21- return { binaryPath, filePath, cwd : projectRootPath } ;
22- } else {
23- return null ;
24- }
23+ return { binaryPath, filePath, cwd : projectRootPath } ;
2524 }
2625} ;
2726
Original file line number Diff line number Diff line change @@ -20,7 +20,11 @@ import * as chokidar from "chokidar";
2020import { assert } from "console" ;
2121import { fileURLToPath } from "url" ;
2222import { ChildProcess } from "child_process" ;
23- import { runDumpCommand , runCompletionCommand } from "./dumpCommand" ;
23+ import {
24+ binaryExists ,
25+ runDumpCommand ,
26+ runCompletionCommand ,
27+ } from "./dumpCommand" ;
2428
2529// https://microsoft.github.io/language-server-protocol/specification#initialize
2630// According to the spec, there could be requests before the 'initialize' request. Link in comment tells how to handle them.
@@ -269,9 +273,11 @@ process.on("message", (msg: m.Message) => {
269273 // TODO: incremental sync?
270274 textDocumentSync : v . TextDocumentSyncKind . Full ,
271275 documentFormattingProvider : true ,
272- hoverProvider : true ,
273- definitionProvider : true ,
274- completionProvider : { triggerCharacters : [ "." ] } ,
276+ hoverProvider : binaryExists ,
277+ definitionProvider : binaryExists ,
278+ completionProvider : binaryExists
279+ ? { triggerCharacters : [ "." ] }
280+ : undefined ,
275281 } ,
276282 } ;
277283 let response : m . ResponseMessage = {
You can’t perform that action at this time.
0 commit comments