Skip to content

Commit

Permalink
src/goDebugConfiguration.ts: allow users to debug with older versions…
Browse files Browse the repository at this point in the history
… of dlv-dap

Delve DAP has been stable for a while so using an old version of dlv-dap is not
too much of concern. We still prompt to update dlv-dap but we no longer stop users
who decided not to update right now.

Fixes #1814

Change-Id: Ieb8fa62833a7f901c242e36a261c613bda5e24f1
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/369753
Trust: Hyang-Ah Hana Kim <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
TryBot-Result: kokoro <[email protected]>
Reviewed-by: Polina Sokolova <[email protected]>
hyangah committed Dec 8, 2021
1 parent 7919ded commit bf2ce37
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/goDebugConfiguration.ts
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
import { lstatSync } from 'fs';
import path = require('path');
import vscode = require('vscode');
import { ContinuedEvent } from 'vscode-debugadapter';
import { getGoConfig } from './config';
import { toolExecutionEnvironment } from './goEnv';
import {
@@ -27,7 +28,7 @@ import { getBinPath, getGoVersion } from './util';
import { parseEnvFiles } from './utils/envUtils';
import { resolveHomeDir } from './utils/pathUtils';

let dlvDAPVersionCurrent = false;
let dlvDAPVersionChecked = false;

export class GoDebugConfigurationProvider implements vscode.DebugConfigurationProvider {
constructor(private defaultDebugAdapterType: string = 'go') {}
@@ -265,7 +266,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
}
debugConfiguration['dlvToolPath'] = dlvToolPath;

if (debugAdapter === 'dlv-dap' && !dlvDAPVersionCurrent) {
if (debugAdapter === 'dlv-dap' && !dlvDAPVersionChecked) {
const tool = getToolAtVersion('dlv-dap');
if (await shouldUpdateTool(tool, dlvToolPath)) {
// If the user has opted in to automatic tool updates, we can update
@@ -276,13 +277,13 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
const toolVersion = { ...tool, version: tool.latestVersion }; // ToolWithVersion
await installTools([toolVersion], goVersion, true);
} else {
// If we are prompting the user to update, we do not want to continue
// with this debug session.
promptForUpdatingTool(tool.name);
return;
await promptForUpdatingTool(tool.name);
}
// installTools could've failed (e.g. no network access) or the user decliend to install dlv-dap
// in promptForUpdatingTool. If dlv-dap doesn't exist or dlv-dap is too old to have MVP features,
// the failure will be visible to users when launching the dlv-dap process (crash or error message).
}
dlvDAPVersionCurrent = true;
dlvDAPVersionChecked = true;
}

if (debugConfiguration['mode'] === 'auto') {

0 comments on commit bf2ce37

Please sign in to comment.