diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts index bcec6e539..8302377a2 100644 --- a/src/goInstallTools.ts +++ b/src/goInstallTools.ts @@ -346,6 +346,7 @@ export async function promptForMissingTool(toolName: string) { const installOptions = ['Install']; let missing = await getMissingTools(goVersion); if (!containsTool(missing, tool)) { + console.log(`not containsTool ${missing}, ${tool}, ${goVersion}`); return; } missing = missing.filter((x) => x === tool || tool.isImportant); @@ -544,9 +545,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..a8a25dfbf 100644 --- a/src/goLanguageServer.ts +++ b/src/goLanguageServer.ts @@ -284,6 +284,7 @@ export function getLanguageServerToolPath(): string { } const alternateTools = goConfig['alternateTools']; if (alternateTools) { + console.log('alternateTools ' + JSON.stringify(alternateTools, null, 2)); // The user's alternate language server was not found. const goplsAlternate = alternateTools['gopls']; if (goplsAlternate) { @@ -298,9 +299,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'); }