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";
6
6
import * as tmp from "tmp" ;
7
7
import fs from "fs" ;
8
8
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
+
9
17
let findExecutable = ( uri : string ) => {
10
18
let filePath = fileURLToPath ( uri ) ;
11
19
let projectRootPath = utils . findProjectRootOfFile ( filePath ) ;
12
- if ( projectRootPath == null ) {
20
+ if ( projectRootPath == null || ! binaryExists ) {
13
21
return null ;
14
22
} 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 } ;
25
24
}
26
25
} ;
27
26
Original file line number Diff line number Diff line change @@ -20,7 +20,11 @@ import * as chokidar from "chokidar";
20
20
import { assert } from "console" ;
21
21
import { fileURLToPath } from "url" ;
22
22
import { ChildProcess } from "child_process" ;
23
- import { runDumpCommand , runCompletionCommand } from "./dumpCommand" ;
23
+ import {
24
+ binaryExists ,
25
+ runDumpCommand ,
26
+ runCompletionCommand ,
27
+ } from "./dumpCommand" ;
24
28
25
29
// https://microsoft.github.io/language-server-protocol/specification#initialize
26
30
// 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) => {
269
273
// TODO: incremental sync?
270
274
textDocumentSync : v . TextDocumentSyncKind . Full ,
271
275
documentFormattingProvider : true ,
272
- hoverProvider : true ,
273
- definitionProvider : true ,
274
- completionProvider : { triggerCharacters : [ "." ] } ,
276
+ hoverProvider : binaryExists ,
277
+ definitionProvider : binaryExists ,
278
+ completionProvider : binaryExists
279
+ ? { triggerCharacters : [ "." ] }
280
+ : undefined ,
275
281
} ,
276
282
} ;
277
283
let response : m . ResponseMessage = {
You can’t perform that action at this time.
0 commit comments