From 239823f1ef5d9320137a0ac9a5a0c052a734aac0 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Sun, 31 Dec 2023 18:57:46 +0800 Subject: [PATCH 01/29] Modify the language id Modify the language id so that it is unique. Only trigger activation extension for files supported by gop language --- package.json | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/package.json b/package.json index 1dbe8b2e85..82ba467cff 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,6 @@ "node": ">=12.0.0" }, "activationEvents": [ - "onLanguage:go", "onLanguage:gop", "workspaceContains:*.go", "workspaceContains:*/*.go", @@ -124,18 +123,10 @@ }, "contributes": { "languages": [ - { - "id": "go", - "extensions": [ - ".go" - ], - "aliases": [ - "Go" - ] - }, { "id": "gop", "extensions": [ + ".go", ".gop", ".spx", ".rdx", From f0b4bcc6396bd740914ad228f7626d609ed5aa91 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Sun, 31 Dec 2023 19:27:19 +0800 Subject: [PATCH 02/29] change default debug adapter Modify the initial debug run configuration and default debug run configuration. Change the debugger type to gop. Make it unique. --- package.json | 34 +++++++++---------- src/goDebugConfiguration.ts | 66 +++++++++++++++++++++++++++++++++++-- 2 files changed, 80 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 82ba467cff..c9ca92a42a 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "workspaceContains:**/*.spx", "workspaceContains:**/*.rdx", "onDebugInitialConfigurations", - "onDebugResolve:go", + "onDebugResolve:gop", "onWebviewPanel:welcomeGo" ], "main": "./dist/goMain.js", @@ -600,51 +600,51 @@ ], "breakpoints": [ { - "language": "go" + "language": "gop" } ], "debuggers": [ { - "type": "go", - "label": "Go", + "type": "gop", + "label": "Gop", "program": "./dist/debugAdapter.js", "runtime": "node", "languages": [ - "go" + "gop" ], "variables": { - "pickProcess": "go.debug.pickProcess", - "pickGoProcess": "go.debug.pickGoProcess" + "pickProcess": "gop.debug.pickProcess", + "pickGoProcess": "gop.debug.pickGoProcess" }, "configurationSnippets": [ { - "label": "Go: Launch package", + "label": "Gop: Launch package", "description": "Debug/test the package in the program attribute", "body": { "name": "${2:Launch Package}", - "type": "go", + "type": "gop", "request": "launch", "mode": "auto", "program": "^\"\\${fileDirname}${1:}\"" } }, { - "label": "Go: Launch file", + "label": "Gop: Launch file", "description": "Debug the file in the program attribute", "body": { "name": "${2:Launch file}", - "type": "go", + "type": "gop", "request": "launch", "mode": "debug", "program": "^\"${1:\\${file\\}}\"" } }, { - "label": "Go: Launch test function", + "label": "Gop: Launch test function", "description": "Debug the test function in the args, ensure program attributes points to right package", "body": { "name": "${3:Launch test function}", - "type": "go", + "type": "gop", "request": "launch", "mode": "test", "program": "^\"\\${workspaceFolder}${1:}\"", @@ -655,22 +655,22 @@ } }, { - "label": "Go: Attach to local process", + "label": "Gop: Attach to local process", "description": "Attach to an existing process by process ID", "body": { "name": "${1:Attach to Process}", - "type": "go", + "type": "gop", "request": "attach", "mode": "local", "processId": 0 } }, { - "label": "Go: Connect to server", + "label": "Gop: Connect to server", "description": "Connect to a remote headless debug server", "body": { "name": "${1:Connect to server}", - "type": "go", + "type": "gop", "request": "attach", "mode": "remote", "remotePath": "^\"\\${workspaceFolder}\"", diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index 0e4aae057d..20ab7cce89 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -37,7 +37,7 @@ let dlvDAPVersionChecked = false; export class GoDebugConfigurationProvider implements vscode.DebugConfigurationProvider { static activate(ctx: vscode.ExtensionContext, goCtx: GoExtensionContext) { ctx.subscriptions.push( - vscode.debug.registerDebugConfigurationProvider('go', new GoDebugConfigurationProvider('go')) + vscode.debug.registerDebugConfigurationProvider('gop', new GoDebugConfigurationProvider('gop')) ); const registerCommand = createRegisterCommand(ctx, goCtx); // goxls: conflicts fix @@ -45,7 +45,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr registerCommand('gop.debug.pickGoProcess', () => pickGoProcess); } - constructor(private defaultDebugAdapterType: string = 'go') {} + constructor(private defaultDebugAdapterType: string = 'gop') {} public async provideDebugConfigurations( folder: vscode.WorkspaceFolder | undefined, @@ -114,6 +114,66 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr config.port = port; } } + }, + // for gop + { + label: 'Gop: Launch Package', + description: 'Debug/test the package of the open file', + config: { + name: 'Launch Package', + type: this.defaultDebugAdapterType, + request: 'launch', + mode: 'auto', + program: '${fileDirname}' + } + }, + { + label: 'Gop: Attach to local process', + description: 'Attach to an existing process by process ID', + config: { + name: 'Attach to Process', + type: 'gop', + request: 'attach', + mode: 'local', + processId: 0 + } + }, + { + label: 'Gop: Connect to server', + description: 'Connect to a remote headless debug server', + config: { + name: 'Connect to server', + type: 'gop', + request: 'attach', + mode: 'remote', + remotePath: '${workspaceFolder}', + port: 2345, + host: '127.0.0.1' + }, + fill: async (config: vscode.DebugConfiguration) => { + const host = await vscode.window.showInputBox({ + prompt: 'Enter hostname', + value: '127.0.0.1' + }); + if (host) { + config.host = host; + } + const port = Number( + await vscode.window.showInputBox({ + prompt: 'Enter port', + value: '2345', + validateInput: (value: string) => { + if (isNaN(Number(value))) { + return 'Please enter a number.'; + } + return ''; + } + }) + ); + if (port) { + config.port = port; + } + } } ]; @@ -138,7 +198,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr const activeEditor = vscode.window.activeTextEditor; if (!debugConfiguration || !debugConfiguration.request) { // if 'request' is missing interpret this as a missing launch.json - if (!activeEditor || activeEditor.document.languageId !== 'go') { + if (!activeEditor || activeEditor.document.languageId !== 'gop') { return; } From 8dc2729f320ae8fcd275654251f626907c330076 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Sun, 31 Dec 2023 20:29:22 +0800 Subject: [PATCH 03/29] language id --- package-lock.json | 22 +++++++++-- package.json | 7 ++-- src/commands/runBuilds.ts | 2 +- src/goBuild.ts | 2 +- src/goCheck.ts | 2 +- src/goDebugConfiguration.ts | 60 ----------------------------- src/goInstall.ts | 2 +- src/goLint.ts | 2 +- src/goMain.ts | 6 +-- src/goVet.ts | 2 +- src/language/legacy/goLiveErrors.ts | 2 +- test/mocks/MockTest.ts | 2 +- 12 files changed, 33 insertions(+), 78 deletions(-) diff --git a/package-lock.json b/package-lock.json index 874359bc73..2f02fd07e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,19 @@ { - "name": "goplus", - "version": "0.1.0-dev", + "name": "gop", + "version": "0.8.1-dev", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "goplus", - "version": "0.1.0-dev", + "name": "gop", + "version": "0.8.1-dev", "license": "MIT", "dependencies": { "diff": "4.0.2", "glob": "7.1.7", "json-rpc2": "2.0.0", "moment": "2.29.4", + "package": "^1.0.1", "semver": "7.3.4", "tree-kill": "file:third_party/tree-kill", "vscode-debugadapter": "1.45.0", @@ -4303,6 +4304,14 @@ "node": ">=6" } }, + "node_modules/package": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package/-/package-1.0.1.tgz", + "integrity": "sha512-g6xZR6CO7okjie83sIRJodgGvaXqymfE5GLhN8N2TmZGShmHc/V23hO/vWbdnuy3D81As3pfovw72gGi42l9qA==", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -8947,6 +8956,11 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "package": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package/-/package-1.0.1.tgz", + "integrity": "sha512-g6xZR6CO7okjie83sIRJodgGvaXqymfE5GLhN8N2TmZGShmHc/V23hO/vWbdnuy3D81As3pfovw72gGi42l9qA==" + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", diff --git a/package.json b/package.json index c9ca92a42a..92cbbe0424 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "glob": "7.1.7", "json-rpc2": "2.0.0", "moment": "2.29.4", + "package": "^1.0.1", "semver": "7.3.4", "tree-kill": "file:third_party/tree-kill", "vscode-debugadapter": "1.45.0", @@ -2089,10 +2090,10 @@ "description": "Alternate tools or alternate paths for the same tools used by the Go extension. Provide either absolute path or the name of the binary in GOPATH/bin, GOROOT/bin or PATH. Useful when you want to use wrapper script for the Go tools.", "scope": "resource", "properties": { - "go": { + "gop": { "type": "string", - "default": "go", - "description": "Alternate tool to use instead of the go binary or alternate path to use for the go binary." + "default": "gop", + "description": "Alternate tool to use instead of the gop binary or alternate path to use for the go binary." }, "gopls": { "type": "string", diff --git a/src/commands/runBuilds.ts b/src/commands/runBuilds.ts index ecc3b64ec5..1129f0af20 100644 --- a/src/commands/runBuilds.ts +++ b/src/commands/runBuilds.ts @@ -13,7 +13,7 @@ export const runBuilds: CommandFactory = (ctx, goCtx) => ( document: vscode.TextDocument, goConfig: vscode.WorkspaceConfiguration ) => { - if (document.languageId !== 'go') { + if (document.languageId !== 'go' || document.languageId !== 'gop') { return; } diff --git a/src/goBuild.ts b/src/goBuild.ts index 2bb9912917..ddeda99cb9 100644 --- a/src/goBuild.ts +++ b/src/goBuild.ts @@ -34,7 +34,7 @@ export function buildCode(buildWorkspace?: boolean): CommandFactory { vscode.window.showInformationMessage('No editor is active, cannot find current package to build'); return; } - if (editor.document.languageId !== 'go') { + if (editor.document.languageId !== 'go' || editor.document.languageId !== 'gop') { vscode.window.showInformationMessage( 'File in the active editor is not a Go file, cannot find current package to build' ); diff --git a/src/goCheck.ts b/src/goCheck.ts index 4307cd5151..54189515c5 100644 --- a/src/goCheck.ts +++ b/src/goCheck.ts @@ -36,7 +36,7 @@ export function removeTestStatus(e: vscode.TextDocumentChangeEvent) { export function notifyIfGeneratedFile(this: void, e: vscode.TextDocumentChangeEvent) { const ctx: any = this; - if (e.document.isUntitled || e.document.languageId !== 'go') { + if (e.document.isUntitled || e.document.languageId !== 'go' || e.document.languageId !== 'gop') { return; } if ( diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index 20ab7cce89..d8ec6564cf 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -56,66 +56,6 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr public async pickConfiguration(): Promise { const debugConfigurations = [ - { - label: 'Go: Launch Package', - description: 'Debug/test the package of the open file', - config: { - name: 'Launch Package', - type: this.defaultDebugAdapterType, - request: 'launch', - mode: 'auto', - program: '${fileDirname}' - } - }, - { - label: 'Go: Attach to local process', - description: 'Attach to an existing process by process ID', - config: { - name: 'Attach to Process', - type: 'go', - request: 'attach', - mode: 'local', - processId: 0 - } - }, - { - label: 'Go: Connect to server', - description: 'Connect to a remote headless debug server', - config: { - name: 'Connect to server', - type: 'go', - request: 'attach', - mode: 'remote', - remotePath: '${workspaceFolder}', - port: 2345, - host: '127.0.0.1' - }, - fill: async (config: vscode.DebugConfiguration) => { - const host = await vscode.window.showInputBox({ - prompt: 'Enter hostname', - value: '127.0.0.1' - }); - if (host) { - config.host = host; - } - const port = Number( - await vscode.window.showInputBox({ - prompt: 'Enter port', - value: '2345', - validateInput: (value: string) => { - if (isNaN(Number(value))) { - return 'Please enter a number.'; - } - return ''; - } - }) - ); - if (port) { - config.port = port; - } - } - }, - // for gop { label: 'Gop: Launch Package', description: 'Debug/test the package of the open file', diff --git a/src/goInstall.ts b/src/goInstall.ts index 2e006c8909..4b0599651b 100644 --- a/src/goInstall.ts +++ b/src/goInstall.ts @@ -20,7 +20,7 @@ export const installCurrentPackage: CommandFactory = () => async () => { vscode.window.showInformationMessage('No editor is active, cannot find current package to install'); return; } - if (editor.document.languageId !== 'go') { + if (editor.document.languageId !== 'go' || editor.document.languageId !== 'gop') { vscode.window.showInformationMessage( 'File in the active editor is not a Go file, cannot find current package to install' ); diff --git a/src/goLint.ts b/src/goLint.ts index 4f2c5c5e8f..0567852412 100644 --- a/src/goLint.ts +++ b/src/goLint.ts @@ -23,7 +23,7 @@ export function lintCode(scope?: string): CommandFactory { vscode.window.showInformationMessage('No editor is active, cannot find current package to lint'); return; } - if (editor.document.languageId !== 'go') { + if (editor.document.languageId !== 'go' || editor.document.languageId !== 'gop') { vscode.window.showInformationMessage( 'File in the active editor is not a Go file, cannot find current package to lint' ); diff --git a/src/goMain.ts b/src/goMain.ts index ee2a43b995..7880ead4d1 100644 --- a/src/goMain.ts +++ b/src/goMain.ts @@ -114,7 +114,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise { vscode.commands.executeCommand('gop.builds.run', activeDoc, getGoConfig(activeDoc.uri)); @@ -325,11 +325,11 @@ function addOnSaveTextDocumentListeners(ctx: vscode.ExtensionContext) { vscode.workspace.onDidSaveTextDocument(removeCodeCoverageOnFileSave, null, ctx.subscriptions); vscode.workspace.onDidSaveTextDocument( (document) => { - if (document.languageId !== 'go') { + if (document.languageId !== 'go' || document.languageId !== 'gop') { return; } const session = vscode.debug.activeDebugSession; - if (session && session.type === 'go') { + if (session && (session.type === 'go' || session.type === 'gop')) { const neverAgain = { title: "Don't Show Again" }; const ignoreActiveDebugWarningKey = 'ignoreActiveDebugWarningKey'; const ignoreActiveDebugWarning = getFromGlobalState(ignoreActiveDebugWarningKey); diff --git a/src/goVet.ts b/src/goVet.ts index c7efb70a4d..514ec39129 100644 --- a/src/goVet.ts +++ b/src/goVet.ts @@ -28,7 +28,7 @@ export function vetCode(vetWorkspace?: boolean): CommandFactory { vscode.window.showInformationMessage('No editor is active, cannot find current package to vet'); return; } - if (editor?.document.languageId !== 'go' && !vetWorkspace) { + if ((editor?.document.languageId !== 'go' || editor?.document.languageId !== 'gop') && !vetWorkspace) { vscode.window.showInformationMessage( 'File in the active editor is not a Go file, cannot find current package to vet' ); diff --git a/src/language/legacy/goLiveErrors.ts b/src/language/legacy/goLiveErrors.ts index 318df4c24d..7731d73460 100644 --- a/src/language/legacy/goLiveErrors.ts +++ b/src/language/legacy/goLiveErrors.ts @@ -54,7 +54,7 @@ export function parseLiveFile(goCtx: GoExtensionContext, e: vscode.TextDocumentC if (e.document.isUntitled) { return; } - if (e.document.languageId !== 'go') { + if (e.document.languageId !== 'go' || e.document.languageId !=='gop') { return; } if (!goLiveErrorsEnabled()) { diff --git a/test/mocks/MockTest.ts b/test/mocks/MockTest.ts index 86c146e28e..33eac11d6b 100644 --- a/test/mocks/MockTest.ts +++ b/test/mocks/MockTest.ts @@ -255,7 +255,7 @@ class MockTestDocument implements TextDocument { constructor( public uri: Uri, private _contents: string, - public languageId: string = 'go', + public languageId: string = 'gop', public isUntitled: boolean = false, public isDirty: boolean = false ) {} From ead25e6a62ec4166bb3fa9ed61d44b417bf22b15 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 09:15:34 +0800 Subject: [PATCH 04/29] chage goDebugFactory and version --- package.json | 2 +- src/goDebugFactory.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 92cbbe0424..11f7d0a983 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gop", "displayName": "Go+ (beta)", - "version": "0.8.1-dev", + "version": "0.8.2", "preview": false, "publisher": "goplus", "description": "Rich Go/Go+ language support for Visual Studio Code", diff --git a/src/goDebugFactory.ts b/src/goDebugFactory.ts index b216290790..552533568b 100644 --- a/src/goDebugFactory.ts +++ b/src/goDebugFactory.ts @@ -18,17 +18,17 @@ import { getWorkspaceFolderPath } from './util'; import { getEnvPath, getBinPathFromEnvVar } from './utils/pathUtils'; export function activate(ctx: vscode.ExtensionContext) { - const debugOutputChannel = vscode.window.createOutputChannel('Go Debug'); + const debugOutputChannel = vscode.window.createOutputChannel('Gop Debug'); ctx.subscriptions.push(debugOutputChannel); const factory = new GoDebugAdapterDescriptorFactory(debugOutputChannel); - ctx.subscriptions.push(vscode.debug.registerDebugAdapterDescriptorFactory('go', factory)); + ctx.subscriptions.push(vscode.debug.registerDebugAdapterDescriptorFactory('gop', factory)); if ('dispose' in factory) { ctx.subscriptions.push(factory); } const tracker = new GoDebugAdapterTrackerFactory(debugOutputChannel); - ctx.subscriptions.push(vscode.debug.registerDebugAdapterTrackerFactory('go', tracker)); + ctx.subscriptions.push(vscode.debug.registerDebugAdapterTrackerFactory('gop', tracker)); if ('dispose' in tracker) { ctx.subscriptions.push(tracker); } @@ -442,7 +442,7 @@ export class DelveDAPOutputAdapter extends ProxyDebugAdapter { command: 'runInTerminal', arguments: { kind: console, - title: `Go Debug Terminal (${launchAttachArgs.name})`, + title: `Gop Debug Terminal (${launchAttachArgs.name})`, cwd: dir, args: dlvArgs, env: env From 2aee4fbbb29ec2b3d577970009ea9283dceee616 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 16:52:51 +0800 Subject: [PATCH 05/29] add .gop support, not only .go --- package-lock.json | 4 ++-- package.json | 16 ++++++++++++++-- src/commands/applyCoverprofile.ts | 4 +++- src/commands/toggleGCDetails.ts | 2 +- src/debugAdapter/goDebug.ts | 2 +- src/goCover.ts | 2 +- src/goDebugConfiguration.ts | 6 ++++-- src/goFillStruct.ts | 4 ++-- src/goGenerateTests.ts | 6 +++--- src/goTest/explore.ts | 2 +- src/goTest/resolve.ts | 6 +++--- src/util.ts | 9 +++++---- 12 files changed, 40 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f02fd07e8..4d00515d08 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gop", - "version": "0.8.1-dev", + "version": "0.8.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "gop", - "version": "0.8.1-dev", + "version": "0.8.5", "license": "MIT", "dependencies": { "diff": "4.0.2", diff --git a/package.json b/package.json index 11f7d0a983..6ed90b522e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gop", "displayName": "Go+ (beta)", - "version": "0.8.2", + "version": "0.8.5", "preview": false, "publisher": "goplus", "description": "Rich Go/Go+ language support for Visual Studio Code", @@ -95,6 +95,7 @@ "node": ">=12.0.0" }, "activationEvents": [ + "onLanguage:go", "onLanguage:gop", "workspaceContains:*.go", "workspaceContains:*/*.go", @@ -103,6 +104,7 @@ "workspaceContains:**/*.spx", "workspaceContains:**/*.rdx", "onDebugInitialConfigurations", + "onDebugResolve:go", "onDebugResolve:gop", "onWebviewPanel:welcomeGo" ], @@ -124,6 +126,13 @@ }, "contributes": { "languages": [ + { + "id":"go", + "extensions": [ + ".go" + ], + "aliases": ["Go"] + }, { "id": "gop", "extensions": [ @@ -602,6 +611,9 @@ "breakpoints": [ { "language": "gop" + }, + { + "language": "go" } ], "debuggers": [ @@ -611,7 +623,7 @@ "program": "./dist/debugAdapter.js", "runtime": "node", "languages": [ - "gop" + "gop", "go" ], "variables": { "pickProcess": "gop.debug.pickProcess", diff --git a/src/commands/applyCoverprofile.ts b/src/commands/applyCoverprofile.ts index f4cc9be25f..ee01836816 100644 --- a/src/commands/applyCoverprofile.ts +++ b/src/commands/applyCoverprofile.ts @@ -13,7 +13,9 @@ import { fileExists } from '../utils/pathUtils'; export const applyCoverprofile: CommandFactory = () => { return () => { - if (!vscode.window.activeTextEditor || !vscode.window.activeTextEditor.document.fileName.endsWith('.go')) { + if (!vscode.window.activeTextEditor || !(vscode.window.activeTextEditor.document.fileName.endsWith('.go') || + vscode.window.activeTextEditor.document.fileName.endsWith('.gop') + )) { vscode.window.showErrorMessage('Cannot apply coverage profile when no Go file is open.'); return; } diff --git a/src/commands/toggleGCDetails.ts b/src/commands/toggleGCDetails.ts index 2565ad6e5a..3db5ca90d4 100644 --- a/src/commands/toggleGCDetails.ts +++ b/src/commands/toggleGCDetails.ts @@ -16,7 +16,7 @@ export const toggleGCDetails: CommandFactory = (ctx, goCtx) => { return; } const doc = vscode.window.activeTextEditor?.document.uri.toString(); - if (!doc || !doc.endsWith('.go')) { + if (!doc || !(doc.endsWith('.go') || doc.endsWith('.gop'))) { vscode.window.showErrorMessage('"Go: Toggle gc details" command cannot run when no Go file is open.'); return; } diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index 960c379e80..5155bea4e9 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -479,7 +479,7 @@ export class Delve { } dlvCwd = program; isProgramDirectory = true; - } else if (mode !== 'exec' && path.extname(program) !== '.go') { + } else if (mode !== 'exec' && (path.extname(program) !== '.go' || path.extname(program) !== '.gop')) { logError(`The program "${program}" must be a valid go file in debug mode`); return reject('The program attribute must be a directory or .go file in debug mode'); } diff --git a/src/goCover.ts b/src/goCover.ts index 628598879b..50c65f18de 100644 --- a/src/goCover.ts +++ b/src/goCover.ts @@ -268,7 +268,7 @@ export function applyCodeCoverageToAllEditors(coverProfilePath: string, dir?: st // goxls: shadow main startcol = 0 let col = parseInt(parse[3], 10); - if (col < 1 && !filename.endsWith('.go')) { + if (col < 1 && !(filename.endsWith('.go') || filename.endsWith('.gop'))) { col = 1; } const startLine = parseInt(parse[2], 10); diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index d8ec6564cf..69aaff1484 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -318,7 +318,9 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr if (debugConfiguration['mode'] === 'auto') { let filename = activeEditor?.document?.fileName; - if (debugConfiguration['program'] && debugConfiguration['program'].endsWith('.go')) { + if ( debugConfiguration['program'] && + (debugConfiguration['program'].endsWith('.go') || debugConfiguration['program'].endsWith('.gop')) + ) { // If the 'program' attribute is a file, not a directory, then we will determine the mode from that // file path instead of the currently active file. filename = debugConfiguration['program']; @@ -535,7 +537,7 @@ export function parseDebugProgramArgSync( return { program, dirname: program, programIsDirectory: true }; } const ext = path.extname(program); - if (ext === '.go') { + if (ext === '.go' || ext === 'gop') { // TODO(hyangah): .s? return { program, dirname: path.dirname(program), programIsDirectory: false }; } diff --git a/src/goFillStruct.ts b/src/goFillStruct.ts index 006c5ebd23..0e66cf8f60 100644 --- a/src/goFillStruct.ts +++ b/src/goFillStruct.ts @@ -35,8 +35,8 @@ function getCommonArgs(editor: vscode.TextEditor): string[] | undefined { vscode.window.showInformationMessage('No editor is active.'); return; } - if (!editor.document.fileName.endsWith('.go')) { - vscode.window.showInformationMessage('Current file is not a Go file.'); + if (!(editor.document.fileName.endsWith('.go') || editor.document.fileName.endsWith('.gop'))) { + vscode.window.showInformationMessage('Current file is not a Go or Gop file.'); return; } const args = ['-modified', '-file', editor.document.fileName]; diff --git a/src/goGenerateTests.ts b/src/goGenerateTests.ts index 6fc406d238..274a624974 100644 --- a/src/goGenerateTests.ts +++ b/src/goGenerateTests.ts @@ -54,12 +54,12 @@ export const toggleTestFile: CommandFactory = () => () => { } const currentFilePath = editor.document.fileName; if (!currentFilePath.endsWith('.go') && !currentFilePath.endsWith('.gop')) { - vscode.window.showInformationMessage('Cannot toggle test file. File in the editor is not a Go file.'); + vscode.window.showInformationMessage('Cannot toggle test file. File in the editor is not a Go or Gop file.'); return; } let targetFilePath = ''; - if (currentFilePath.endsWith('.go')) { - if (currentFilePath.endsWith('_test.go')) { + if (currentFilePath.endsWith('.go') || currentFilePath.endsWith('.gop')) { + if (currentFilePath.endsWith('_test.go') || currentFilePath.endsWith('_test.gop')) { //xx_test.go => xx.go //xx_test.go => xx.gop targetFilePath = currentFilePath.substr(0, currentFilePath.lastIndexOf('_test.go')) + '.go'; diff --git a/src/goTest/explore.ts b/src/goTest/explore.ts index 8f26b11ccd..c45414ae16 100644 --- a/src/goTest/explore.ts +++ b/src/goTest/explore.ts @@ -314,7 +314,7 @@ export class GoTestExplorer { // Handle opened documents, document changes, and file creation. private async documentUpdate(doc: TextDocument, ranges?: Range[]) { - if (!doc.uri.path.endsWith('_test.go')) { + if (!doc.uri.path.endsWith('_test.go') && !doc.uri.path.endsWith('_test.gop')) { return; } diff --git a/src/goTest/resolve.ts b/src/goTest/resolve.ts index 9dea67bc66..5bf28e13c3 100644 --- a/src/goTest/resolve.ts +++ b/src/goTest/resolve.ts @@ -116,7 +116,7 @@ export class GoTestResolver { // The user expanded a module or package - find all files if (kind === 'module' || kind === 'package') { for (const [file, type] of await this.workspace.fs.readDirectory(item.uri)) { - if (type !== FileType.File || !file.endsWith('_test.go')) { + if (type !== FileType.File || !(file.endsWith('_test.go') || file.endsWith('_test.gop'))) { continue; } @@ -510,7 +510,7 @@ async function walkWorkspaces(fs: FileSystem, uri: Uri): Promise Promise) { await walk(fs, uri, async (dir, file) => { - if (file.endsWith('_test.go')) { + if (file.endsWith('_test.go') || file.endsWith('_test.gop')) { await cb(dir); return WalkStop.Files; } diff --git a/src/util.ts b/src/util.ts index 5aa91056af..00c5f5f814 100644 --- a/src/util.ts +++ b/src/util.ts @@ -347,7 +347,8 @@ export async function getGoVersion(goBinPath?: string): Promise { error(`cached Go version (${JSON.stringify(cachedGoVersion)}) is invalid, recomputing`); } const docUri = vscode.window.activeTextEditor?.document.uri; - const cwd = getWorkspaceFolderPath(docUri && docUri.fsPath.endsWith('.go') ? docUri : undefined); + const cond = (docUri && (docUri.fsPath.endsWith('.go') || docUri.fsPath.endsWith('.gop'))) + const cwd = getWorkspaceFolderPath(cond ? docUri : undefined); let goVersion: GoVersion | undefined; try { @@ -682,14 +683,14 @@ export function getImportPath(text: string): string { export function guessPackageNameFromFile(filePath: string): Promise { return new Promise((resolve, reject) => { const goFilename = path.basename(filePath); - if (goFilename === 'main.go') { + if (goFilename === 'main.go' || goFilename === 'main.gop') { return resolve(['main']); } const directoryPath = path.dirname(filePath); const dirName = path.basename(directoryPath); let segments = dirName.split(/[.-]/); - segments = segments.filter((val) => val !== 'go'); + segments = segments.filter((val) => (val !== 'go' && val !== 'gop')); if (segments.length === 0 || !/[a-zA-Z_]\w*/.test(segments[segments.length - 1])) { return reject(); @@ -848,7 +849,7 @@ export function handleDiagnosticErrors( // Also add other open .go files known to vscode for fast lookup. vscode.workspace.textDocuments.forEach((t) => { const fileName = t.uri.toString(); - if (!fileName.endsWith('.go')) { + if (!fileName.endsWith('.go') && !fileName.endsWith('.gop')) { return; } textDocumentMap.set(fileName, t); From 03ba373916d8e43ff1b3f8c5dc5bb6ecf212dcc8 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 17:17:44 +0800 Subject: [PATCH 06/29] fix compile error --- src/commands/runBuilds.ts | 2 +- src/goBuild.ts | 2 +- src/goCheck.ts | 2 +- src/goInstall.ts | 2 +- src/goLint.ts | 2 +- src/goMain.ts | 2 +- src/goVet.ts | 2 +- src/language/legacy/goLiveErrors.ts | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/commands/runBuilds.ts b/src/commands/runBuilds.ts index 1129f0af20..08947bb786 100644 --- a/src/commands/runBuilds.ts +++ b/src/commands/runBuilds.ts @@ -13,7 +13,7 @@ export const runBuilds: CommandFactory = (ctx, goCtx) => ( document: vscode.TextDocument, goConfig: vscode.WorkspaceConfiguration ) => { - if (document.languageId !== 'go' || document.languageId !== 'gop') { + if (document.languageId !== 'go' && document.languageId !== 'gop') { return; } diff --git a/src/goBuild.ts b/src/goBuild.ts index ddeda99cb9..53143e25fd 100644 --- a/src/goBuild.ts +++ b/src/goBuild.ts @@ -34,7 +34,7 @@ export function buildCode(buildWorkspace?: boolean): CommandFactory { vscode.window.showInformationMessage('No editor is active, cannot find current package to build'); return; } - if (editor.document.languageId !== 'go' || editor.document.languageId !== 'gop') { + if (editor.document.languageId !== 'go' && editor.document.languageId !== 'gop') { vscode.window.showInformationMessage( 'File in the active editor is not a Go file, cannot find current package to build' ); diff --git a/src/goCheck.ts b/src/goCheck.ts index 54189515c5..bdc290fff2 100644 --- a/src/goCheck.ts +++ b/src/goCheck.ts @@ -36,7 +36,7 @@ export function removeTestStatus(e: vscode.TextDocumentChangeEvent) { export function notifyIfGeneratedFile(this: void, e: vscode.TextDocumentChangeEvent) { const ctx: any = this; - if (e.document.isUntitled || e.document.languageId !== 'go' || e.document.languageId !== 'gop') { + if (e.document.isUntitled || e.document.languageId !== 'go' && e.document.languageId !== 'gop') { return; } if ( diff --git a/src/goInstall.ts b/src/goInstall.ts index 4b0599651b..b904439215 100644 --- a/src/goInstall.ts +++ b/src/goInstall.ts @@ -20,7 +20,7 @@ export const installCurrentPackage: CommandFactory = () => async () => { vscode.window.showInformationMessage('No editor is active, cannot find current package to install'); return; } - if (editor.document.languageId !== 'go' || editor.document.languageId !== 'gop') { + if (editor.document.languageId !== 'go' && editor.document.languageId !== 'gop') { vscode.window.showInformationMessage( 'File in the active editor is not a Go file, cannot find current package to install' ); diff --git a/src/goLint.ts b/src/goLint.ts index 0567852412..316d43f161 100644 --- a/src/goLint.ts +++ b/src/goLint.ts @@ -23,7 +23,7 @@ export function lintCode(scope?: string): CommandFactory { vscode.window.showInformationMessage('No editor is active, cannot find current package to lint'); return; } - if (editor.document.languageId !== 'go' || editor.document.languageId !== 'gop') { + if (editor.document.languageId !== 'go' && editor.document.languageId !== 'gop') { vscode.window.showInformationMessage( 'File in the active editor is not a Go file, cannot find current package to lint' ); diff --git a/src/goMain.ts b/src/goMain.ts index 7880ead4d1..4fd6d17390 100644 --- a/src/goMain.ts +++ b/src/goMain.ts @@ -325,7 +325,7 @@ function addOnSaveTextDocumentListeners(ctx: vscode.ExtensionContext) { vscode.workspace.onDidSaveTextDocument(removeCodeCoverageOnFileSave, null, ctx.subscriptions); vscode.workspace.onDidSaveTextDocument( (document) => { - if (document.languageId !== 'go' || document.languageId !== 'gop') { + if (document.languageId !== 'go' && document.languageId !== 'gop') { return; } const session = vscode.debug.activeDebugSession; diff --git a/src/goVet.ts b/src/goVet.ts index 514ec39129..fdac4d3cb6 100644 --- a/src/goVet.ts +++ b/src/goVet.ts @@ -28,7 +28,7 @@ export function vetCode(vetWorkspace?: boolean): CommandFactory { vscode.window.showInformationMessage('No editor is active, cannot find current package to vet'); return; } - if ((editor?.document.languageId !== 'go' || editor?.document.languageId !== 'gop') && !vetWorkspace) { + if ((editor?.document.languageId !== 'go' && editor?.document.languageId !== 'gop') && !vetWorkspace) { vscode.window.showInformationMessage( 'File in the active editor is not a Go file, cannot find current package to vet' ); diff --git a/src/language/legacy/goLiveErrors.ts b/src/language/legacy/goLiveErrors.ts index 7731d73460..83f1870efb 100644 --- a/src/language/legacy/goLiveErrors.ts +++ b/src/language/legacy/goLiveErrors.ts @@ -54,7 +54,7 @@ export function parseLiveFile(goCtx: GoExtensionContext, e: vscode.TextDocumentC if (e.document.isUntitled) { return; } - if (e.document.languageId !== 'go' || e.document.languageId !=='gop') { + if (e.document.languageId !== 'go' && e.document.languageId !=='gop') { return; } if (!goLiveErrorsEnabled()) { From 8430ef53a05380b3a64bb2d6967c526b161e9e72 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 18:17:01 +0800 Subject: [PATCH 07/29] fix lint errors --- src/commands/applyCoverprofile.ts | 6 +++--- src/debugAdapter/goDebug.ts | 2 +- src/goCheck.ts | 2 +- src/goDebugConfiguration.ts | 8 ++++---- src/goMain.ts | 3 ++- src/goVet.ts | 2 +- src/language/legacy/goLiveErrors.ts | 2 +- src/util.ts | 4 ++-- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/commands/applyCoverprofile.ts b/src/commands/applyCoverprofile.ts index ee01836816..58f3a7dba9 100644 --- a/src/commands/applyCoverprofile.ts +++ b/src/commands/applyCoverprofile.ts @@ -13,9 +13,9 @@ import { fileExists } from '../utils/pathUtils'; export const applyCoverprofile: CommandFactory = () => { return () => { - if (!vscode.window.activeTextEditor || !(vscode.window.activeTextEditor.document.fileName.endsWith('.go') || - vscode.window.activeTextEditor.document.fileName.endsWith('.gop') - )) { + const fileName = vscode.window.activeTextEditor?.document.fileName; + const notSuportFile = !fileName?.endsWith('.go') && !fileName?.endsWith('.gop'); + if (!vscode.window.activeTextEditor || notSuportFile) { vscode.window.showErrorMessage('Cannot apply coverage profile when no Go file is open.'); return; } diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index 5155bea4e9..19148b35f6 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -479,7 +479,7 @@ export class Delve { } dlvCwd = program; isProgramDirectory = true; - } else if (mode !== 'exec' && (path.extname(program) !== '.go' || path.extname(program) !== '.gop')) { + } else if (mode !== 'exec' && path.extname(program) !== '.go' && path.extname(program) !== '.gop') { logError(`The program "${program}" must be a valid go file in debug mode`); return reject('The program attribute must be a directory or .go file in debug mode'); } diff --git a/src/goCheck.ts b/src/goCheck.ts index bdc290fff2..7e14c5b92c 100644 --- a/src/goCheck.ts +++ b/src/goCheck.ts @@ -36,7 +36,7 @@ export function removeTestStatus(e: vscode.TextDocumentChangeEvent) { export function notifyIfGeneratedFile(this: void, e: vscode.TextDocumentChangeEvent) { const ctx: any = this; - if (e.document.isUntitled || e.document.languageId !== 'go' && e.document.languageId !== 'gop') { + if (e.document.isUntitled || (e.document.languageId !== 'go' && e.document.languageId !== 'gop')) { return; } if ( diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index 69aaff1484..21dbb2cbda 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -318,12 +318,12 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr if (debugConfiguration['mode'] === 'auto') { let filename = activeEditor?.document?.fileName; - if ( debugConfiguration['program'] && - (debugConfiguration['program'].endsWith('.go') || debugConfiguration['program'].endsWith('.gop')) - ) { + const program = debugConfiguration['program']; + const suportFileType = program.endsWith('.go') || program.endsWith('.gop'); + if (program && suportFileType) { // If the 'program' attribute is a file, not a directory, then we will determine the mode from that // file path instead of the currently active file. - filename = debugConfiguration['program']; + filename = program; } debugConfiguration['mode'] = filename?.endsWith('_test.go') || filename?.endsWith('_test.gop') ? 'test' : 'debug'; diff --git a/src/goMain.ts b/src/goMain.ts index 4fd6d17390..327b6f095a 100644 --- a/src/goMain.ts +++ b/src/goMain.ts @@ -114,7 +114,8 @@ export async function activate(ctx: vscode.ExtensionContext): Promise { vscode.commands.executeCommand('gop.builds.run', activeDoc, getGoConfig(activeDoc.uri)); diff --git a/src/goVet.ts b/src/goVet.ts index fdac4d3cb6..0e51bdf001 100644 --- a/src/goVet.ts +++ b/src/goVet.ts @@ -28,7 +28,7 @@ export function vetCode(vetWorkspace?: boolean): CommandFactory { vscode.window.showInformationMessage('No editor is active, cannot find current package to vet'); return; } - if ((editor?.document.languageId !== 'go' && editor?.document.languageId !== 'gop') && !vetWorkspace) { + if (editor?.document.languageId !== 'go' && editor?.document.languageId !== 'gop' && !vetWorkspace) { vscode.window.showInformationMessage( 'File in the active editor is not a Go file, cannot find current package to vet' ); diff --git a/src/language/legacy/goLiveErrors.ts b/src/language/legacy/goLiveErrors.ts index 83f1870efb..076bc84da0 100644 --- a/src/language/legacy/goLiveErrors.ts +++ b/src/language/legacy/goLiveErrors.ts @@ -54,7 +54,7 @@ export function parseLiveFile(goCtx: GoExtensionContext, e: vscode.TextDocumentC if (e.document.isUntitled) { return; } - if (e.document.languageId !== 'go' && e.document.languageId !=='gop') { + if (e.document.languageId !== 'go' && e.document.languageId !== 'gop') { return; } if (!goLiveErrorsEnabled()) { diff --git a/src/util.ts b/src/util.ts index 00c5f5f814..017b2e0ba0 100644 --- a/src/util.ts +++ b/src/util.ts @@ -347,7 +347,7 @@ export async function getGoVersion(goBinPath?: string): Promise { error(`cached Go version (${JSON.stringify(cachedGoVersion)}) is invalid, recomputing`); } const docUri = vscode.window.activeTextEditor?.document.uri; - const cond = (docUri && (docUri.fsPath.endsWith('.go') || docUri.fsPath.endsWith('.gop'))) + const cond = docUri && (docUri.fsPath.endsWith('.go') || docUri.fsPath.endsWith('.gop')); const cwd = getWorkspaceFolderPath(cond ? docUri : undefined); let goVersion: GoVersion | undefined; @@ -690,7 +690,7 @@ export function guessPackageNameFromFile(filePath: string): Promise { const directoryPath = path.dirname(filePath); const dirName = path.basename(directoryPath); let segments = dirName.split(/[.-]/); - segments = segments.filter((val) => (val !== 'go' && val !== 'gop')); + segments = segments.filter((val) => val !== 'go' && val !== 'gop'); if (segments.length === 0 || !/[a-zA-Z_]\w*/.test(segments[segments.length - 1])) { return reject(); From 9a557b7f158d89c25cf598f329da1366afa08351 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 18:32:20 +0800 Subject: [PATCH 08/29] fix mac os build error --- src/debugAdapter/goDebug.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index 19148b35f6..9da883c43c 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -198,6 +198,8 @@ interface EvalOut { } enum GoVariableFlags { + VariableUnknownError = 0, + VariableEscaped = 1, VariableShadowed = 2, VariableConstant = 4, From 0974e06410a92f741dbacc75572f0588525692c0 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 18:37:51 +0800 Subject: [PATCH 09/29] empty --- src/debugAdapter/goDebug.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index 9da883c43c..59e9322e1d 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -198,8 +198,7 @@ interface EvalOut { } enum GoVariableFlags { - VariableUnknownError = 0, - + VariableFixMacosCompileError = 0, VariableEscaped = 1, VariableShadowed = 2, VariableConstant = 4, From 632b6e58844363978e1431a6800d69326de28efb Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 19:10:22 +0800 Subject: [PATCH 10/29] fix .gop --- src/goDebugConfiguration.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index 21dbb2cbda..bea3331e2d 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -537,7 +537,7 @@ export function parseDebugProgramArgSync( return { program, dirname: program, programIsDirectory: true }; } const ext = path.extname(program); - if (ext === '.go' || ext === 'gop') { + if (ext === '.go' || ext === '.gop') { // TODO(hyangah): .s? return { program, dirname: path.dirname(program), programIsDirectory: false }; } From 2cd9fb236e06ce4442f411c5c951b43d019386ce Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 19:50:45 +0800 Subject: [PATCH 11/29] skip some test --- test/testdata/baseTest/sample_test.go | 1 + test/testdata/codelens/codelens_go118_test.go | 1 + test/testdata/codelens/codelens_test.go | 1 + test/testdata/goTestTest/a_test.go | 1 + test/testdata/goTestTest/b/b_test.go | 1 + 5 files changed, 5 insertions(+) diff --git a/test/testdata/baseTest/sample_test.go b/test/testdata/baseTest/sample_test.go index 918549abaf..07ee857787 100644 --- a/test/testdata/baseTest/sample_test.go +++ b/test/testdata/baseTest/sample_test.go @@ -1,3 +1,4 @@ +//go:build skip-test package main import ( diff --git a/test/testdata/codelens/codelens_go118_test.go b/test/testdata/codelens/codelens_go118_test.go index bd7656701d..6efae6a923 100644 --- a/test/testdata/codelens/codelens_go118_test.go +++ b/test/testdata/codelens/codelens_go118_test.go @@ -1,3 +1,4 @@ +//go:build skip-test //go:build go1.18 // +build go1.18 diff --git a/test/testdata/codelens/codelens_test.go b/test/testdata/codelens/codelens_test.go index 348113999f..09d4d40e9c 100644 --- a/test/testdata/codelens/codelens_test.go +++ b/test/testdata/codelens/codelens_test.go @@ -1,3 +1,4 @@ +//go:build skip-test package main import ( diff --git a/test/testdata/goTestTest/a_test.go b/test/testdata/goTestTest/a_test.go index 66a943a1b4..a47e80243e 100644 --- a/test/testdata/goTestTest/a_test.go +++ b/test/testdata/goTestTest/a_test.go @@ -1,3 +1,4 @@ +//go:build skip-test package main import ( diff --git a/test/testdata/goTestTest/b/b_test.go b/test/testdata/goTestTest/b/b_test.go index 2240f6f539..8b653592fd 100644 --- a/test/testdata/goTestTest/b/b_test.go +++ b/test/testdata/goTestTest/b/b_test.go @@ -1,3 +1,4 @@ +//go:build skip-test package main import "testing" From d870214e5a3f3ec6c2250e7031b9389e87700936 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 20:06:15 +0800 Subject: [PATCH 12/29] change version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6ed90b522e..29c54404af 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gop", "displayName": "Go+ (beta)", - "version": "0.8.5", + "version": "0.8.1.dev", "preview": false, "publisher": "goplus", "description": "Rich Go/Go+ language support for Visual Studio Code", From 51f97e8ae77a98763d87264e603fc3019b41b176 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 20:10:04 +0800 Subject: [PATCH 13/29] undo skip test --- test/testdata/baseTest/sample_test.go | 1 - test/testdata/codelens/codelens_test.go | 1 - test/testdata/goTestTest/a_test.go | 1 - test/testdata/goTestTest/b/b_test.go | 1 - 4 files changed, 4 deletions(-) diff --git a/test/testdata/baseTest/sample_test.go b/test/testdata/baseTest/sample_test.go index 07ee857787..918549abaf 100644 --- a/test/testdata/baseTest/sample_test.go +++ b/test/testdata/baseTest/sample_test.go @@ -1,4 +1,3 @@ -//go:build skip-test package main import ( diff --git a/test/testdata/codelens/codelens_test.go b/test/testdata/codelens/codelens_test.go index 09d4d40e9c..348113999f 100644 --- a/test/testdata/codelens/codelens_test.go +++ b/test/testdata/codelens/codelens_test.go @@ -1,4 +1,3 @@ -//go:build skip-test package main import ( diff --git a/test/testdata/goTestTest/a_test.go b/test/testdata/goTestTest/a_test.go index a47e80243e..66a943a1b4 100644 --- a/test/testdata/goTestTest/a_test.go +++ b/test/testdata/goTestTest/a_test.go @@ -1,4 +1,3 @@ -//go:build skip-test package main import ( diff --git a/test/testdata/goTestTest/b/b_test.go b/test/testdata/goTestTest/b/b_test.go index 8b653592fd..2240f6f539 100644 --- a/test/testdata/goTestTest/b/b_test.go +++ b/test/testdata/goTestTest/b/b_test.go @@ -1,4 +1,3 @@ -//go:build skip-test package main import "testing" From 75f9136887abe083ce4ca9dc6fbee636c8117b4a Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 20:11:50 +0800 Subject: [PATCH 14/29] undo skip test --- test/testdata/codelens/codelens_go118_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/test/testdata/codelens/codelens_go118_test.go b/test/testdata/codelens/codelens_go118_test.go index 6efae6a923..bd7656701d 100644 --- a/test/testdata/codelens/codelens_go118_test.go +++ b/test/testdata/codelens/codelens_go118_test.go @@ -1,4 +1,3 @@ -//go:build skip-test //go:build go1.18 // +build go1.18 From e3043fc99ddd999910fdd45c254e606e7e14e74e Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 20:32:32 +0800 Subject: [PATCH 15/29] change version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4d00515d08..b4c4c357f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gop", - "version": "0.8.5", + "version": "0.8.1.dev", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "gop", - "version": "0.8.5", + "version": "0.8.1.dev", "license": "MIT", "dependencies": { "diff": "4.0.2", diff --git a/package.json b/package.json index 29c54404af..e0421b098f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gop", "displayName": "Go+ (beta)", - "version": "0.8.1.dev", + "version": "0.8.2-dev", "preview": false, "publisher": "goplus", "description": "Rich Go/Go+ language support for Visual Studio Code", From 56aeefae3fc9ea27745e1703a518e0b8003ada22 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Mon, 1 Jan 2024 20:52:11 +0800 Subject: [PATCH 16/29] check all languageId condition again --- package-lock.json | 4 ++-- src/goDebugConfiguration.ts | 2 +- test/mocks/MockTest.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index b4c4c357f8..5c5f2a7249 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gop", - "version": "0.8.1.dev", + "version": "0.8.2-dev", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "gop", - "version": "0.8.1.dev", + "version": "0.8.2-dev", "license": "MIT", "dependencies": { "diff": "4.0.2", diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index bea3331e2d..8139ee166c 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -138,7 +138,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr const activeEditor = vscode.window.activeTextEditor; if (!debugConfiguration || !debugConfiguration.request) { // if 'request' is missing interpret this as a missing launch.json - if (!activeEditor || activeEditor.document.languageId !== 'gop') { + if (!activeEditor || (activeEditor.document.languageId !== 'gop' && activeEditor.document.languageId !== 'go')) { return; } diff --git a/test/mocks/MockTest.ts b/test/mocks/MockTest.ts index 33eac11d6b..86c146e28e 100644 --- a/test/mocks/MockTest.ts +++ b/test/mocks/MockTest.ts @@ -255,7 +255,7 @@ class MockTestDocument implements TextDocument { constructor( public uri: Uri, private _contents: string, - public languageId: string = 'gop', + public languageId: string = 'go', public isUntitled: boolean = false, public isDirty: boolean = false ) {} From 4e48ee892298e26266cf0af9d0867ffce3c6f34c Mon Sep 17 00:00:00 2001 From: tsingbx Date: Wed, 10 Jan 2024 14:58:34 +0800 Subject: [PATCH 17/29] add substitutePath --- package.json | 7 ++++--- src/goDebugConfiguration.ts | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index e0421b098f..86c8b3931e 100644 --- a/package.json +++ b/package.json @@ -136,7 +136,6 @@ { "id": "gop", "extensions": [ - ".go", ".gop", ".spx", ".rdx", @@ -638,7 +637,8 @@ "type": "gop", "request": "launch", "mode": "auto", - "program": "^\"\\${fileDirname}${1:}\"" + "program": "^\"\\${fileDirname}${1:}\"", + "substitutePath": [{"from": "^\"\\${fileDirname}\"", "to": ""}] } }, { @@ -649,7 +649,8 @@ "type": "gop", "request": "launch", "mode": "debug", - "program": "^\"${1:\\${file\\}}\"" + "program": "^\"${1:\\${file\\}}\"", + "substitutePath": [{"from": "^\"\\${fileDirname}\"", "to": ""}] } }, { diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index 8139ee166c..d091264f18 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -64,7 +64,8 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr type: this.defaultDebugAdapterType, request: 'launch', mode: 'auto', - program: '${fileDirname}' + program: '${fileDirname}', + substitutePath: [{from: "${fileDirname}", to: ""}] } }, { @@ -147,7 +148,8 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr type: this.defaultDebugAdapterType, request: 'launch', mode: 'auto', - program: path.dirname(activeEditor.document.fileName) // matches ${fileDirname} + program: path.dirname(activeEditor.document.fileName), // matches ${fileDirname} + substitutePath: [{from: "${fileDirname}", to: ""}] }); } From c619af4992402c56d4bc220af0f2d957cfd699cf Mon Sep 17 00:00:00 2001 From: tsingbx Date: Wed, 10 Jan 2024 19:11:25 +0800 Subject: [PATCH 18/29] only apply substitute rule for .gop file --- src/debugAdapter/goDebug.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index 59e9322e1d..d5b286673c 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -1097,6 +1097,7 @@ export class GoDebugSession extends LoggingDebugSession { } protected async toDebuggerPath(filePath: string): Promise { + if (this.substitutePath?.length === 0) { if (this.delve?.isRemoteDebugging) { // The user trusts us to infer the remote path mapping! @@ -1113,10 +1114,11 @@ export class GoDebugSession extends LoggingDebugSession { // The filePath may have a different path separator than the localPath // So, update it to use the same separator for ease in path replacement. filePath = normalizeSeparators(filePath); + const ext = path.extname(filePath); let substitutedPath = filePath; let substituteRule: { from: string; to: string }; this.substitutePath?.forEach((value) => { - if (filePath.startsWith(value.from)) { + if (ext === ".gop" && filePath.startsWith(value.from)) { if (substituteRule) { log( `Substitutition rule ${value.from}:${value.to} applies to local path ${filePath} but it was already mapped to debugger path using rule ${substituteRule.from}:${substituteRule.to}` From 376820c3a6de041bd3b104211f3ebe6ea784cf0b Mon Sep 17 00:00:00 2001 From: tsingbx Date: Thu, 11 Jan 2024 09:44:55 +0800 Subject: [PATCH 19/29] undo --- src/debugAdapter/goDebug.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index d5b286673c..8b1fc7594c 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -1118,7 +1118,7 @@ export class GoDebugSession extends LoggingDebugSession { let substitutedPath = filePath; let substituteRule: { from: string; to: string }; this.substitutePath?.forEach((value) => { - if (ext === ".gop" && filePath.startsWith(value.from)) { + if (filePath.startsWith(value.from)) { if (substituteRule) { log( `Substitutition rule ${value.from}:${value.to} applies to local path ${filePath} but it was already mapped to debugger path using rule ${substituteRule.from}:${substituteRule.to}` From 909421d4f090379ccdf68c492d12349b4063f033 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Thu, 11 Jan 2024 15:01:05 +0800 Subject: [PATCH 20/29] change dlv to gopdlv --- src/debugAdapter/goDebug.ts | 24 ++++++++++++------------ src/goDebugConfiguration.ts | 20 ++++++++++++-------- src/goDebugFactory.ts | 7 ++++--- src/goToolsInformation.ts | 11 +++++++++++ 4 files changed, 39 insertions(+), 23 deletions(-) diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index 8b1fc7594c..8a4886eb3d 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -481,12 +481,12 @@ export class Delve { dlvCwd = program; isProgramDirectory = true; } else if (mode !== 'exec' && path.extname(program) !== '.go' && path.extname(program) !== '.gop') { - logError(`The program "${program}" must be a valid go file in debug mode`); - return reject('The program attribute must be a directory or .go file in debug mode'); + logError(`The program "${program}" must be a valid go or gop file in debug mode`); + return reject('The program attribute must be a directory or .go or .gop file in debug mode'); } } catch (e) { logError(`The program "${program}" does not exist: ${e}`); - return reject('The program attribute must point to valid directory, .go file or executable.'); + return reject('The program attribute must point to valid directory, .go or .gop file or executable.'); } // read env from disk and merge into env variables @@ -528,12 +528,12 @@ export class Delve { build.push(program); } - const goExe = getBinPathWithPreferredGopathGoroot('go', []); + const gopExe = getBinPathWithPreferredGopathGoroot('gop', []); log(`Current working directory: ${dirname}`); - log(`Building: ${goExe} ${build.join(' ')}`); + log(`Building: ${gopExe} ${build.join(' ')}`); // Use spawnSync to ensure that the binary exists before running it. - const buffer = spawnSync(goExe, build, buildOptions); + const buffer = spawnSync(gopExe, build, buildOptions); if (buffer.stderr && buffer.stderr.length > 0) { const str = buffer.stderr.toString(); if (this.onstderr) { @@ -608,24 +608,24 @@ export class Delve { if (!existsSync(launchArgs.dlvToolPath)) { log( - `Couldn't find dlv at the Go tools path, ${process.env['GOPATH']}${ + `Couldn't find gopdlv at the Go tools path, ${process.env['GOPATH']}${ env['GOPATH'] ? ', ' + env['GOPATH'] : '' } or ${getEnvPath()}` ); return reject( - 'Cannot find Delve debugger. Install from https://github.com/go-delve/delve & ensure it is in your Go tools path, "GOPATH/bin" or "PATH".' + 'Cannot find Gop/go debugger. Install from https://github.com/goplus/gopdlv & ensure it is in your Go tools path, "GOPATH/bin" or "PATH".' ); } - const currentGOWorkspace = getCurrentGoWorkspaceFromGOPATH(env['GOPATH'], dirname); + const currentGOPWorkspace = getCurrentGoWorkspaceFromGOPATH(env['GOPATH'], dirname); if (!launchArgs.packagePathToGoModPathMap) { launchArgs.packagePathToGoModPathMap = {}; } dlvArgs.push(mode || 'debug'); if (mode === 'exec' || (mode === 'debug' && !isProgramDirectory)) { dlvArgs.push(program); - } else if (currentGOWorkspace && !launchArgs.packagePathToGoModPathMap[dirname]) { - dlvArgs.push(dirname.substr(currentGOWorkspace.length + 1)); + } else if (currentGOPWorkspace && !launchArgs.packagePathToGoModPathMap[dirname]) { + dlvArgs.push(dirname.substr(currentGOPWorkspace.length + 1)); } // add user-specified dlv flags first. When duplicate flags are specified, // dlv doesn't mind but accepts the last flag value. @@ -668,7 +668,7 @@ export class Delve { if (!existsSync(launchArgs.dlvToolPath)) { return reject( - 'Cannot find Delve debugger. Install from https://github.com/go-delve/delve & ensure it is in your Go tools path, "GOPATH/bin" or "PATH".' + 'Cannot find Gop/go debugger. Install from https://github.com/goplus/gopdlv & ensure it is in your Go tools path, "GOPATH/bin" or "PATH".' ); } diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index d091264f18..0eb9763c98 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -218,11 +218,14 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr if (!debugConfiguration.hasOwnProperty('apiVersion') && dlvConfig.hasOwnProperty('apiVersion')) { debugConfiguration['apiVersion'] = dlvConfig['apiVersion']; } + + const dlvLoadConfigName = 'dlvLoadConfig'; + const dlvLoadConfigInspectKey = dlvLoadConfigName + '.dlvLoadConfig'; //delveConfig.dlvLoadConfig if ( debugAdapter === 'dlv-dap' && - (debugConfiguration.hasOwnProperty('dlvLoadConfig') || - goConfig.inspect('delveConfig.dlvLoadConfig')?.globalValue !== undefined || - goConfig.inspect('delveConfig.dlvLoadConfig')?.workspaceValue !== undefined) + (debugConfiguration.hasOwnProperty(dlvLoadConfigName) || + goConfig.inspect(dlvLoadConfigInspectKey)?.globalValue !== undefined || + goConfig.inspect(dlvLoadConfigInspectKey)?.workspaceValue !== undefined) ) { this.showWarning( 'ignoreDebugDlvConfigWithDlvDapWarning', @@ -241,7 +244,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr 'hideSystemGoroutines' ]; if (debugAdapter !== 'dlv-dap') { - dlvProperties.push('dlvLoadConfig'); + dlvProperties.push(dlvLoadConfigName); } dlvProperties.forEach((p) => { if (!debugConfiguration.hasOwnProperty(p)) { @@ -286,13 +289,14 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr } } - const dlvToolPath = getBinPath('dlv'); + const dlvName = 'gopdlv'; + const dlvToolPath = getBinPath(dlvName); if (!path.isAbsolute(dlvToolPath)) { // If user has not already declined to install this tool, // prompt for it. Otherwise continue and have the lack of // dlv binary be caught later. - if (!declinedToolInstall('dlv')) { - await promptForMissingTool('dlv'); + if (!declinedToolInstall(dlvName)) { + await promptForMissingTool(dlvName); return; } } @@ -300,7 +304,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr // For dlv-dap mode, check if the dlv is recent enough to support DAP. if (debugAdapter === 'dlv-dap' && !dlvDAPVersionChecked) { - const tool = getToolAtVersion('dlv'); + const tool = getToolAtVersion(dlvName); if (await shouldUpdateTool(tool, dlvToolPath)) { // If the user has opted in to automatic tool updates, we can update // without prompting. diff --git a/src/goDebugFactory.ts b/src/goDebugFactory.ts index 552533568b..7a59d68070 100644 --- a/src/goDebugFactory.ts +++ b/src/goDebugFactory.ts @@ -622,7 +622,8 @@ function spawnDlvDapServerProcess( function getSpawnConfig(launchAttachArgs: vscode.DebugConfiguration, logErr: (msg: string) => void) { // launchArgsEnv is user-requested env vars (envFiles + env + toolsEnvVars). const env = launchAttachArgs.env; - const dlvPath = launchAttachArgs.dlvToolPath ?? 'dlv'; + const dlvName = 'gopdlv'; + const dlvPath = launchAttachArgs.dlvToolPath ?? dlvName; if (!fs.existsSync(dlvPath)) { const envPath = getEnvPath(); @@ -630,9 +631,9 @@ function getSpawnConfig(launchAttachArgs: vscode.DebugConfiguration, logErr: (ms `Couldn't find ${dlvPath} at the Go tools path, ${process.env['GOPATH']}${ env['GOPATH'] ? ', ' + env['GOPATH'] : '' } or ${envPath}\n` + - 'Follow the setup instruction in https://github.com/golang/vscode-go/blob/master/docs/debugging.md#getting-started.\n' + 'Follow the setup instruction in https://github.com/goplus/vscode-gop/blob/goplus/docs/debugging.md#getting-started.\n' ); - throw new Error('Cannot find Delve debugger (dlv dap)'); + throw new Error('Cannot find Gop/go debugger (gopdlv dap)'); } let dir = getWorkspaceFolderPath(); if (launchAttachArgs.request === 'launch' && launchAttachArgs['__buildDir']) { diff --git a/src/goToolsInformation.ts b/src/goToolsInformation.ts index a8be2b29e2..9fd1d6e2f4 100644 --- a/src/goToolsInformation.ts +++ b/src/goToolsInformation.ts @@ -240,6 +240,17 @@ export const allToolsInformation: { [key: string]: Tool } = { latestVersionTimestamp: moment('2021-05-19', 'YYYY-MM-DD'), minimumGoVersion: semver.coerce('1.12') // dlv requires 1.12+ for build }, + 'gopdlv': { + name: 'gopdlv', + importPath: 'github.com/goplus/delve/cmd/gopdlv', + modulePath: 'github.com/goplus/gopdlv', + replacedByGopls: false, + isImportant: true, + description: 'Go/Go+ Debugger', + latestVersion: semver.parse('1.18'), // minimum version that supports DAP + latestVersionTimestamp: moment('2021-05-19', 'YYYY-MM-DD'), + minimumGoVersion: semver.coerce('1.12') // dlv requires 1.12+ for build + }, 'fillstruct': { name: 'fillstruct', importPath: 'github.com/davidrjenni/reftools/cmd/fillstruct', From 3c77965ed180422ab77d1e1c2048850ff83aa1e9 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Fri, 12 Jan 2024 10:14:46 +0800 Subject: [PATCH 21/29] fix gopdlv install fail --- src/goInstallTools.ts | 6 +++--- src/goToolsInformation.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts index f87f3250fb..924176645c 100644 --- a/src/goInstallTools.ts +++ b/src/goInstallTools.ts @@ -193,7 +193,7 @@ export async function installTools( const failures: { tool: ToolAtVersion; reason: string }[] = []; for (const tool of missing) { - const failed = await installToolWithGo(tool, goForInstall, envForTools, tool.name === 'goxls'); + const failed = await installToolWithGo(tool, goForInstall, envForTools, tool.name === 'goxls' || tool.name === 'gopdlv'); if (failed) { failures.push({ tool, reason: failed }); } else if (tool.name === 'goxls' || tool.name === 'gopls') { @@ -434,7 +434,7 @@ export async function promptForMissingTool(toolName: string) { installOptions.push('Install All'); } let goCmd = 'go'; - if (tool.name == 'goxls') { + if (tool.name == 'goxls' || tool.name == 'gopdlv') { goCmd = 'gop'; } const cmd = `${goCmd} install -v ${getImportPathWithVersion(tool, undefined, goVersion)}`; @@ -490,7 +490,7 @@ export async function promptForUpdatingTool( if (toolName === 'goxls') { choices = ['Always Update', 'Update Once', 'Release Notes']; } - if (toolName === 'dlv') { + if (toolName === 'gopdlv') { choices = ['Always Update', 'Update Once']; } diff --git a/src/goToolsInformation.ts b/src/goToolsInformation.ts index 9fd1d6e2f4..fd62f0d8e5 100644 --- a/src/goToolsInformation.ts +++ b/src/goToolsInformation.ts @@ -242,7 +242,7 @@ export const allToolsInformation: { [key: string]: Tool } = { }, 'gopdlv': { name: 'gopdlv', - importPath: 'github.com/goplus/delve/cmd/gopdlv', + importPath: 'github.com/goplus/gopdlv', modulePath: 'github.com/goplus/gopdlv', replacedByGopls: false, isImportant: true, From 90c88544268d6668c272180bcff7a2d0179abb72 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Fri, 12 Jan 2024 18:08:53 +0800 Subject: [PATCH 22/29] support run test debug --- package.json | 6 ++---- src/goDebugConfiguration.ts | 6 ++---- src/goTest.ts | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 86c8b3931e..ec5295c5f4 100644 --- a/package.json +++ b/package.json @@ -637,8 +637,7 @@ "type": "gop", "request": "launch", "mode": "auto", - "program": "^\"\\${fileDirname}${1:}\"", - "substitutePath": [{"from": "^\"\\${fileDirname}\"", "to": ""}] + "program": "^\"\\${fileDirname}${1:}\"" } }, { @@ -649,8 +648,7 @@ "type": "gop", "request": "launch", "mode": "debug", - "program": "^\"${1:\\${file\\}}\"", - "substitutePath": [{"from": "^\"\\${fileDirname}\"", "to": ""}] + "program": "^\"${1:\\${file\\}}\"" } }, { diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index 0eb9763c98..3d2d189267 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -64,8 +64,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr type: this.defaultDebugAdapterType, request: 'launch', mode: 'auto', - program: '${fileDirname}', - substitutePath: [{from: "${fileDirname}", to: ""}] + program: '${fileDirname}' } }, { @@ -149,7 +148,6 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr request: 'launch', mode: 'auto', program: path.dirname(activeEditor.document.fileName), // matches ${fileDirname} - substitutePath: [{from: "${fileDirname}", to: ""}] }); } @@ -220,7 +218,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr } const dlvLoadConfigName = 'dlvLoadConfig'; - const dlvLoadConfigInspectKey = dlvLoadConfigName + '.dlvLoadConfig'; //delveConfig.dlvLoadConfig + const dlvLoadConfigInspectKey = 'delveConfig.dlvLoadConfig'; if ( debugAdapter === 'dlv-dap' && (debugConfiguration.hasOwnProperty(dlvLoadConfigName) || diff --git a/src/goTest.ts b/src/goTest.ts index 4cc191e914..9c3e624d47 100644 --- a/src/goTest.ts +++ b/src/goTest.ts @@ -284,7 +284,7 @@ export async function debugTestAtCursor( const workspaceFolder = vscode.workspace.getWorkspaceFolder(doc.uri); const debugConfig: vscode.DebugConfiguration = { name: 'Debug Test', - type: 'go', + type: 'gop', request: 'launch', mode: 'test', program: path.dirname(doc.fileName), From 9e54d851c475ef3c9c1b767f7e8e23bd1f5f3064 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Sat, 13 Jan 2024 09:40:24 +0800 Subject: [PATCH 23/29] change desc from dlv to gopdlv --- package.json | 10 +++++----- src/goDebugConfiguration.ts | 2 +- src/goTools.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index ec5295c5f4..2d4fe93ca5 100644 --- a/package.json +++ b/package.json @@ -788,7 +788,7 @@ }, "dlvFlags": { "type": "array", - "description": "Extra flags for `dlv`. See `dlv help` for the full list of supported. Flags such as `--log-output`, `--log`, `--log-dest`, `--api-version`, `--output`, `--backend` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.", + "description": "Extra flags for `gopdlv`. See `gopdlv help` for the full list of supported. Flags such as `--log-output`, `--log`, `--log-dest`, `--api-version`, `--output`, `--backend` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.", "items": { "type": "string" }, @@ -836,7 +836,7 @@ "lldb", "rr" ], - "description": "Backend used by delve. Maps to `dlv`'s `--backend` flag." + "description": "Backend used by delve. Maps to `gopdlv`'s `--backend` flag." }, "output": { "type": "string", @@ -989,7 +989,7 @@ }, "dlvFlags": { "type": "array", - "description": "Extra flags for `dlv`. See `dlv help` for the full list of supported. Flags such as `--log-output`, `--log`, `--log-dest`, `--api-version`, `--output`, `--backend` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.", + "description": "Extra flags for `gopdlv`. See `gopdlv help` for the full list of supported. Flags such as `--log-output`, `--log`, `--log-dest`, `--api-version`, `--output`, `--backend` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.", "items": { "type": "string" }, @@ -1062,7 +1062,7 @@ "lldb", "rr" ], - "description": "Backend used by delve. Maps to `dlv`'s `--backend` flag." + "description": "Backend used by delve. Maps to `gopdlv`'s `--backend` flag." }, "logOutput": { "type": "string", @@ -2064,7 +2064,7 @@ }, "dlvFlags": { "type": "array", - "description": "Extra flags for `dlv`. See `dlv help` for the full list of supported. Flags such as `--log-output`, `--log`, `--log-dest`, `--api-version`, `--output`, `--backend` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.", + "description": "Extra flags for `gopdlv`. See `gopdlv help` for the full list of supported. Flags such as `--log-output`, `--log`, `--log-dest`, `--api-version`, `--output`, `--backend` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.", "items": { "type": "string" }, diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index 3d2d189267..1c26020b2c 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -197,7 +197,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr } else if (debugConfiguration['port']) { this.showWarning( 'ignorePortUsedInDlvDapWarning', - "`port` with 'dlv-dap' debugAdapter connects to [an external `dlv dap` server](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#running-debugee-externally) to launch a program or attach to a process. Remove 'host' and 'port' from your launch.json if you have not launched a 'dlv dap' server." + "`port` with 'dlv-dap' debugAdapter connects to [an external `dlv dap` server](https://github.com/goplus/vscode-gop/blob/goplus/docs/debugging.md#running-debugee-externally) to launch a program or attach to a process. Remove 'host' and 'port' from your launch.json if you have not launched a 'dlv dap' server." ); } } diff --git a/src/goTools.ts b/src/goTools.ts index d4cf433214..025cac9bc7 100644 --- a/src/goTools.ts +++ b/src/goTools.ts @@ -172,7 +172,7 @@ export function getConfiguredTools( // There doesn't seem to be a good way to check if the mips and s390 // families are 64-bit, so just try to install it and hope for the best. if (process.arch.match(/^(mips|mipsel|ppc64|s390|s390x|x64|arm64)$/)) { - maybeAddTool('dlv'); + maybeAddTool('gopdlv'); } // gocode-gomod needed in go 1.11 & higher From 7a158b688ea18235f5a920709365172b8c285f20 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Sat, 13 Jan 2024 10:04:17 +0800 Subject: [PATCH 24/29] fix when debut multi tests will wait forever --- src/goTest/run.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/goTest/run.ts b/src/goTest/run.ts index 7f32f4bf90..3e687b9674 100644 --- a/src/goTest/run.ts +++ b/src/goTest/run.ts @@ -137,7 +137,8 @@ export class GoTestRunner { async debug(request: TestRunRequest, token?: CancellationToken) { if (!request.include) { - await vscode.window.showErrorMessage('The Go test explorer does not support debugging multiple tests'); + //await vscode.window.showErrorMessage('The Go test explorer does not support debugging multiple tests'); + vscode.window.showErrorMessage('The Go+ test explorer does not support debugging multiple tests'); return; } @@ -149,7 +150,8 @@ export class GoTestRunner { const tests = Array.from(collected.values()).reduce((a, b) => a.concat(b), []); if (tests.length > 1) { - await vscode.window.showErrorMessage('The Go test explorer does not support debugging multiple tests'); + //await vscode.window.showErrorMessage('The Go test explorer does not support debugging multiple tests'); + vscode.window.showErrorMessage('The Go+ test explorer does not support debugging multiple tests'); return; } From 7b5b3b5f1c895c96a2638a5c806f6a37cb046fda Mon Sep 17 00:00:00 2001 From: tsingbx Date: Wed, 24 Jan 2024 16:38:19 +0800 Subject: [PATCH 25/29] undo add Debug Test At Cursor --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d4fe93ca5..7f2916d231 100644 --- a/package.json +++ b/package.json @@ -131,7 +131,9 @@ "extensions": [ ".go" ], - "aliases": ["Go"] + "aliases": [ + "Go" + ] }, { "id": "gop", From eaa2e9d2782c9058fa2f2d267842489571d832e7 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Fri, 2 Feb 2024 08:46:36 +0800 Subject: [PATCH 26/29] fix lint error --- src/debugAdapter/goDebug.ts | 3 +-- src/goDebugConfiguration.ts | 7 +++++-- src/goInstallTools.ts | 7 ++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index 8a4886eb3d..3079ef4f6e 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -486,7 +486,7 @@ export class Delve { } } catch (e) { logError(`The program "${program}" does not exist: ${e}`); - return reject('The program attribute must point to valid directory, .go or .gop file or executable.'); + return reject(`The program "${program}" does not exist: ${e}`); } // read env from disk and merge into env variables @@ -1097,7 +1097,6 @@ export class GoDebugSession extends LoggingDebugSession { } protected async toDebuggerPath(filePath: string): Promise { - if (this.substitutePath?.length === 0) { if (this.delve?.isRemoteDebugging) { // The user trusts us to infer the remote path mapping! diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index 1c26020b2c..223bfa4104 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -138,7 +138,10 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr const activeEditor = vscode.window.activeTextEditor; if (!debugConfiguration || !debugConfiguration.request) { // if 'request' is missing interpret this as a missing launch.json - if (!activeEditor || (activeEditor.document.languageId !== 'gop' && activeEditor.document.languageId !== 'go')) { + if ( + !activeEditor || + (activeEditor.document.languageId !== 'gop' && activeEditor.document.languageId !== 'go') + ) { return; } @@ -147,7 +150,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr type: this.defaultDebugAdapterType, request: 'launch', mode: 'auto', - program: path.dirname(activeEditor.document.fileName), // matches ${fileDirname} + program: path.dirname(activeEditor.document.fileName) // matches ${fileDirname} }); } diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts index 924176645c..74a4952868 100644 --- a/src/goInstallTools.ts +++ b/src/goInstallTools.ts @@ -193,7 +193,12 @@ export async function installTools( const failures: { tool: ToolAtVersion; reason: string }[] = []; for (const tool of missing) { - const failed = await installToolWithGo(tool, goForInstall, envForTools, tool.name === 'goxls' || tool.name === 'gopdlv'); + const failed = await installToolWithGo( + tool, + goForInstall, + envForTools, + tool.name === 'goxls' || tool.name === 'gopdlv' + ); if (failed) { failures.push({ tool, reason: failed }); } else if (tool.name === 'goxls' || tool.name === 'gopls') { From 8006085075290116528327562de65073747f5364 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Tue, 6 Feb 2024 10:06:57 +0800 Subject: [PATCH 27/29] update @vscode/test-electron version --- package-lock.json | 390 +++++++++++++++------------------------------- package.json | 2 +- 2 files changed, 125 insertions(+), 267 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5c5f2a7249..9d3ec96659 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "@types/sinon": "9.0.11", "@types/vscode": "1.67.0", "@vscode/debugadapter-testsupport": "1.58.0", - "@vscode/test-electron": "2.2.0", + "@vscode/test-electron": "2.3.8", "@vscode/vsce": "2.19.0", "adm-zip": "0.4.16", "esbuild": "0.17.10", @@ -1047,18 +1047,33 @@ "dev": true }, "node_modules/@vscode/test-electron": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.2.0.tgz", - "integrity": "sha512-xk2xrOTMG75/hxO8OVVZ+GErv9gmdZwOD8rEHV3ty3n1Joav2yFcfrmqD6Ukref27U13LEL8gVvSHzauGAK5nQ==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.8.tgz", + "integrity": "sha512-b4aZZsBKtMGdDljAsOPObnAi7+VWIaYl3ylCz1jTs+oV6BZ4TNHcVNC3xUn0azPeszBmwSBDQYfFESIaUQnrOg==", "dev": true, "dependencies": { "http-proxy-agent": "^4.0.1", "https-proxy-agent": "^5.0.0", - "rimraf": "^3.0.2", - "unzipper": "^0.10.11" + "jszip": "^3.10.1", + "semver": "^7.5.2" }, "engines": { - "node": ">=8.9.3" + "node": ">=16" + } + }, + "node_modules/@vscode/test-electron/node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/@vscode/vsce": { @@ -1430,28 +1445,6 @@ "node": ">=0.8" } }, - "node_modules/big-integer": { - "version": "1.6.48", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz", - "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==", - "dev": true, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/binary": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", - "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", - "dev": true, - "dependencies": { - "buffers": "~0.1.1", - "chainsaw": "~0.1.0" - }, - "engines": { - "node": "*" - } - }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -1488,12 +1481,6 @@ "node": ">= 6" } }, - "node_modules/bluebird": { - "version": "3.4.7", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", - "integrity": "sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM=", - "dev": true - }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -1561,24 +1548,6 @@ "node": "*" } }, - "node_modules/buffer-indexof-polyfill": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz", - "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", - "dev": true, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/buffers": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", - "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=", - "dev": true, - "engines": { - "node": ">=0.2.0" - } - }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -1632,18 +1601,6 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, - "node_modules/chainsaw": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", - "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", - "dev": true, - "dependencies": { - "traverse": ">=0.3.0 <0.4" - }, - "engines": { - "node": "*" - } - }, "node_modules/chalk": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", @@ -2055,15 +2012,6 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, - "node_modules/duplexer2": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", - "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", - "dev": true, - "dependencies": { - "readable-stream": "^2.0.2" - } - }, "node_modules/ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -2787,33 +2735,6 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/fstream": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", - "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - }, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/fstream/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -3228,6 +3149,12 @@ "node": ">= 4" } }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "dev": true + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -3411,6 +3338,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -3528,6 +3461,18 @@ "node": ">=0.6.0" } }, + "node_modules/jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "dev": true, + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, "node_modules/just-extend": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.1.tgz", @@ -3577,6 +3522,15 @@ "node": ">= 0.8.0" } }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, + "dependencies": { + "immediate": "~3.0.5" + } + }, "node_modules/lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", @@ -3592,12 +3546,6 @@ "uc.micro": "^1.0.1" } }, - "node_modules/listenercount": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", - "integrity": "sha1-hMinKrWcRyUyFIDJdeZQg0LnCTc=", - "dev": true - }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -4312,6 +4260,12 @@ "node": ">= 0.6.0" } }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -4744,9 +4698,9 @@ } }, "node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, "dependencies": { "core-util-is": "~1.0.0", @@ -4758,12 +4712,6 @@ "util-deprecate": "~1.0.1" } }, - "node_modules/readable-stream/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -4987,7 +4935,7 @@ "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", "dev": true }, "node_modules/shebang-command": { @@ -5334,15 +5282,6 @@ "node": ">=0.8" } }, - "node_modules/traverse": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", - "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/tree-kill": { "resolved": "third_party/tree-kill", "link": true @@ -5492,24 +5431,6 @@ "node": ">= 10.0.0" } }, - "node_modules/unzipper": { - "version": "0.10.11", - "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.11.tgz", - "integrity": "sha512-+BrAq2oFqWod5IESRjL3S8baohbevGcVA+teAIOYWM3pDVdseogqbzhhvvmiyQrUNKFUnDMtELW3X8ykbyDCJw==", - "dev": true, - "dependencies": { - "big-integer": "^1.6.17", - "binary": "~0.3.0", - "bluebird": "~3.4.1", - "buffer-indexof-polyfill": "~1.0.0", - "duplexer2": "~0.1.4", - "fstream": "^1.0.12", - "graceful-fs": "^4.2.2", - "listenercount": "~1.0.1", - "readable-stream": "~2.3.6", - "setimmediate": "~1.0.4" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -6541,15 +6462,26 @@ "dev": true }, "@vscode/test-electron": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.2.0.tgz", - "integrity": "sha512-xk2xrOTMG75/hxO8OVVZ+GErv9gmdZwOD8rEHV3ty3n1Joav2yFcfrmqD6Ukref27U13LEL8gVvSHzauGAK5nQ==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.8.tgz", + "integrity": "sha512-b4aZZsBKtMGdDljAsOPObnAi7+VWIaYl3ylCz1jTs+oV6BZ4TNHcVNC3xUn0azPeszBmwSBDQYfFESIaUQnrOg==", "dev": true, "requires": { "http-proxy-agent": "^4.0.1", "https-proxy-agent": "^5.0.0", - "rimraf": "^3.0.2", - "unzipper": "^0.10.11" + "jszip": "^3.10.1", + "semver": "^7.5.2" + }, + "dependencies": { + "semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "@vscode/vsce": { @@ -6822,22 +6754,6 @@ "resolved": "https://registry.npmjs.org/better-curry/-/better-curry-1.6.0.tgz", "integrity": "sha1-OPcWskyM7geiYqvEHCLDFOIOOGk=" }, - "big-integer": { - "version": "1.6.48", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz", - "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==", - "dev": true - }, - "binary": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", - "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=", - "dev": true, - "requires": { - "buffers": "~0.1.1", - "chainsaw": "~0.1.0" - } - }, "binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -6870,12 +6786,6 @@ } } }, - "bluebird": { - "version": "3.4.7", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", - "integrity": "sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM=", - "dev": true - }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -6923,18 +6833,6 @@ "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", "dev": true }, - "buffer-indexof-polyfill": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz", - "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", - "dev": true - }, - "buffers": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", - "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=", - "dev": true - }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -6973,15 +6871,6 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, - "chainsaw": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", - "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=", - "dev": true, - "requires": { - "traverse": ">=0.3.0 <0.4" - } - }, "chalk": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", @@ -7280,15 +7169,6 @@ "domhandler": "^5.0.1" } }, - "duplexer2": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", - "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", - "dev": true, - "requires": { - "readable-stream": "^2.0.2" - } - }, "ecc-jsbn": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", @@ -7830,29 +7710,6 @@ "dev": true, "optional": true }, - "fstream": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", - "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - }, - "dependencies": { - "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } - } - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -8137,6 +7994,12 @@ "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, + "immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "dev": true + }, "import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -8275,6 +8138,12 @@ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -8375,6 +8244,18 @@ "verror": "1.10.0" } }, + "jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "dev": true, + "requires": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, "just-extend": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.1.tgz", @@ -8414,6 +8295,15 @@ "type-check": "~0.4.0" } }, + "lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, + "requires": { + "immediate": "~3.0.5" + } + }, "lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", @@ -8429,12 +8319,6 @@ "uc.micro": "^1.0.1" } }, - "listenercount": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", - "integrity": "sha1-hMinKrWcRyUyFIDJdeZQg0LnCTc=", - "dev": true - }, "locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -8961,6 +8845,12 @@ "resolved": "https://registry.npmjs.org/package/-/package-1.0.1.tgz", "integrity": "sha512-g6xZR6CO7okjie83sIRJodgGvaXqymfE5GLhN8N2TmZGShmHc/V23hO/vWbdnuy3D81As3pfovw72gGi42l9qA==" }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -9293,9 +9183,9 @@ } }, "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, "requires": { "core-util-is": "~1.0.0", @@ -9305,14 +9195,6 @@ "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - } } }, "readdirp": { @@ -9474,7 +9356,7 @@ "setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", "dev": true }, "shebang-command": { @@ -9735,12 +9617,6 @@ "punycode": "^2.1.1" } }, - "traverse": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", - "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=", - "dev": true - }, "tree-kill": { "version": "file:third_party/tree-kill" }, @@ -9851,24 +9727,6 @@ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", "dev": true }, - "unzipper": { - "version": "0.10.11", - "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.11.tgz", - "integrity": "sha512-+BrAq2oFqWod5IESRjL3S8baohbevGcVA+teAIOYWM3pDVdseogqbzhhvvmiyQrUNKFUnDMtELW3X8ykbyDCJw==", - "dev": true, - "requires": { - "big-integer": "^1.6.17", - "binary": "~0.3.0", - "bluebird": "~3.4.1", - "buffer-indexof-polyfill": "~1.0.0", - "duplexer2": "~0.1.4", - "fstream": "^1.0.12", - "graceful-fs": "^4.2.2", - "listenercount": "~1.0.1", - "readable-stream": "~2.3.6", - "setimmediate": "~1.0.4" - } - }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 7f2916d231..0234d004f7 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "@types/sinon": "9.0.11", "@types/vscode": "1.67.0", "@vscode/debugadapter-testsupport": "1.58.0", - "@vscode/test-electron": "2.2.0", + "@vscode/test-electron": "2.3.8", "@vscode/vsce": "2.19.0", "adm-zip": "0.4.16", "esbuild": "0.17.10", From 33350867675d3910157fd649847336571a123370 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Wed, 7 Feb 2024 08:42:54 +0800 Subject: [PATCH 28/29] change tip --- package.json | 12 ++++++------ src/debugAdapter/goDebug.ts | 4 ++-- src/goDebugConfiguration.ts | 6 +++--- src/goDebugFactory.ts | 6 +++--- src/goFillStruct.ts | 2 +- src/goGenerateTests.ts | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 0234d004f7..687f3ac9d2 100644 --- a/package.json +++ b/package.json @@ -620,7 +620,7 @@ "debuggers": [ { "type": "gop", - "label": "Gop", + "label": "Go+", "program": "./dist/debugAdapter.js", "runtime": "node", "languages": [ @@ -632,7 +632,7 @@ }, "configurationSnippets": [ { - "label": "Gop: Launch package", + "label": "Go+: Launch package", "description": "Debug/test the package in the program attribute", "body": { "name": "${2:Launch Package}", @@ -643,7 +643,7 @@ } }, { - "label": "Gop: Launch file", + "label": "Go+: Launch file", "description": "Debug the file in the program attribute", "body": { "name": "${2:Launch file}", @@ -654,7 +654,7 @@ } }, { - "label": "Gop: Launch test function", + "label": "Go+: Launch test function", "description": "Debug the test function in the args, ensure program attributes points to right package", "body": { "name": "${3:Launch test function}", @@ -669,7 +669,7 @@ } }, { - "label": "Gop: Attach to local process", + "label": "Go+: Attach to local process", "description": "Attach to an existing process by process ID", "body": { "name": "${1:Attach to Process}", @@ -680,7 +680,7 @@ } }, { - "label": "Gop: Connect to server", + "label": "Go+: Connect to server", "description": "Connect to a remote headless debug server", "body": { "name": "${1:Connect to server}", diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index 3079ef4f6e..6f45e829ea 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -613,7 +613,7 @@ export class Delve { } or ${getEnvPath()}` ); return reject( - 'Cannot find Gop/go debugger. Install from https://github.com/goplus/gopdlv & ensure it is in your Go tools path, "GOPATH/bin" or "PATH".' + 'Cannot find Go/Go+ debugger. Install from https://github.com/goplus/gopdlv & ensure it is in your Go tools path, "GOPATH/bin" or "PATH".' ); } @@ -668,7 +668,7 @@ export class Delve { if (!existsSync(launchArgs.dlvToolPath)) { return reject( - 'Cannot find Gop/go debugger. Install from https://github.com/goplus/gopdlv & ensure it is in your Go tools path, "GOPATH/bin" or "PATH".' + 'Cannot find Go/Go+ debugger. Install from https://github.com/goplus/gopdlv & ensure it is in your Go tools path, "GOPATH/bin" or "PATH".' ); } diff --git a/src/goDebugConfiguration.ts b/src/goDebugConfiguration.ts index 223bfa4104..d290e151e9 100644 --- a/src/goDebugConfiguration.ts +++ b/src/goDebugConfiguration.ts @@ -57,7 +57,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr public async pickConfiguration(): Promise { const debugConfigurations = [ { - label: 'Gop: Launch Package', + label: 'Go+: Launch Package', description: 'Debug/test the package of the open file', config: { name: 'Launch Package', @@ -68,7 +68,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr } }, { - label: 'Gop: Attach to local process', + label: 'Go+: Attach to local process', description: 'Attach to an existing process by process ID', config: { name: 'Attach to Process', @@ -79,7 +79,7 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr } }, { - label: 'Gop: Connect to server', + label: 'Go+: Connect to server', description: 'Connect to a remote headless debug server', config: { name: 'Connect to server', diff --git a/src/goDebugFactory.ts b/src/goDebugFactory.ts index 7a59d68070..111ea03417 100644 --- a/src/goDebugFactory.ts +++ b/src/goDebugFactory.ts @@ -18,7 +18,7 @@ import { getWorkspaceFolderPath } from './util'; import { getEnvPath, getBinPathFromEnvVar } from './utils/pathUtils'; export function activate(ctx: vscode.ExtensionContext) { - const debugOutputChannel = vscode.window.createOutputChannel('Gop Debug'); + const debugOutputChannel = vscode.window.createOutputChannel('Go+ Debug'); ctx.subscriptions.push(debugOutputChannel); const factory = new GoDebugAdapterDescriptorFactory(debugOutputChannel); @@ -442,7 +442,7 @@ export class DelveDAPOutputAdapter extends ProxyDebugAdapter { command: 'runInTerminal', arguments: { kind: console, - title: `Gop Debug Terminal (${launchAttachArgs.name})`, + title: `Go+ Debug Terminal (${launchAttachArgs.name})`, cwd: dir, args: dlvArgs, env: env @@ -633,7 +633,7 @@ function getSpawnConfig(launchAttachArgs: vscode.DebugConfiguration, logErr: (ms } or ${envPath}\n` + 'Follow the setup instruction in https://github.com/goplus/vscode-gop/blob/goplus/docs/debugging.md#getting-started.\n' ); - throw new Error('Cannot find Gop/go debugger (gopdlv dap)'); + throw new Error('Cannot find Go/Go+ debugger (gopdlv dap)'); } let dir = getWorkspaceFolderPath(); if (launchAttachArgs.request === 'launch' && launchAttachArgs['__buildDir']) { diff --git a/src/goFillStruct.ts b/src/goFillStruct.ts index 0e66cf8f60..474ed51feb 100644 --- a/src/goFillStruct.ts +++ b/src/goFillStruct.ts @@ -36,7 +36,7 @@ function getCommonArgs(editor: vscode.TextEditor): string[] | undefined { return; } if (!(editor.document.fileName.endsWith('.go') || editor.document.fileName.endsWith('.gop'))) { - vscode.window.showInformationMessage('Current file is not a Go or Gop file.'); + vscode.window.showInformationMessage('Current file is not a Go or Go+ file.'); return; } const args = ['-modified', '-file', editor.document.fileName]; diff --git a/src/goGenerateTests.ts b/src/goGenerateTests.ts index 274a624974..7c289f8ec1 100644 --- a/src/goGenerateTests.ts +++ b/src/goGenerateTests.ts @@ -33,7 +33,7 @@ function checkActiveEditor(): vscode.TextEditor | undefined { return; } if (!editor.document.fileName.endsWith('.go') && !editor.document.fileName.endsWith('.gop')) { - vscode.window.showInformationMessage('Cannot generate unit tests. File in the editor is not a Go or Gop file.'); + vscode.window.showInformationMessage('Cannot generate unit tests. File in the editor is not a Go or Go+ file.'); return; } if (editor.document.isDirty) { @@ -54,7 +54,7 @@ export const toggleTestFile: CommandFactory = () => () => { } const currentFilePath = editor.document.fileName; if (!currentFilePath.endsWith('.go') && !currentFilePath.endsWith('.gop')) { - vscode.window.showInformationMessage('Cannot toggle test file. File in the editor is not a Go or Gop file.'); + vscode.window.showInformationMessage('Cannot toggle test file. File in the editor is not a Go or Go+ file.'); return; } let targetFilePath = ''; From 4d957e05ebc05524895548abb4703d3c2ed88b29 Mon Sep 17 00:00:00 2001 From: tsingbx Date: Wed, 7 Feb 2024 08:51:58 +0800 Subject: [PATCH 29/29] change reject message --- src/debugAdapter/goDebug.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debugAdapter/goDebug.ts b/src/debugAdapter/goDebug.ts index 6f45e829ea..b1f877bd73 100644 --- a/src/debugAdapter/goDebug.ts +++ b/src/debugAdapter/goDebug.ts @@ -486,7 +486,7 @@ export class Delve { } } catch (e) { logError(`The program "${program}" does not exist: ${e}`); - return reject(`The program "${program}" does not exist: ${e}`); + return reject('The program attribute must point to valid directory, .go/.gop file or executable.'); } // read env from disk and merge into env variables