From a931eabc51e1e61e1bcc9b363214a8504197aab5 Mon Sep 17 00:00:00 2001 From: "Hana (Hyang-Ah) Kim" Date: Mon, 20 Apr 2020 15:26:07 -0400 Subject: [PATCH] src/goLanguageServer: fix missing gopls detection logic Also, update getMissingTools to check the tool's existence by simply checking whether the resolved tool path is absolute. getBinPath already ran the existence check before returning the absolute path for the tool. Fixes microsoft/vscode-go#3194 --- src/goInstallTools.ts | 4 +--- src/goLanguageServer.ts | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts index bcec6e539..20c5d7353 100644 --- a/src/goInstallTools.ts +++ b/src/goInstallTools.ts @@ -544,9 +544,7 @@ function getMissingTools(goVersion: GoVersion): Promise { (tool) => new Promise((resolve, reject) => { const toolPath = getBinPath(tool.name); - fs.exists(toolPath, (exists) => { - resolve(exists ? null : tool); - }); + resolve(path.isAbsolute(toolPath) ? null : tool); }) ) ).then((res) => { diff --git a/src/goLanguageServer.ts b/src/goLanguageServer.ts index 37764a69b..708961995 100644 --- a/src/goLanguageServer.ts +++ b/src/goLanguageServer.ts @@ -298,9 +298,11 @@ Please install it and reload this VS Code window.` if (alternateTools['go-langserver']) { vscode.window.showErrorMessage(`Support for "go-langserver" has been deprecated. The recommended language server is gopls. Delete the alternate tool setting for "go-langserver" to use gopls, or change "go-langserver" to "gopls" in your settings.json and reload the VS Code window.`); + return; } - return; } + + console.log('promptForMissingTools(gopls)'); // Prompt the user to install gopls. promptForMissingTool('gopls'); }