Skip to content

Commit 6e0dbec

Browse files
committed
[release] prepare v0.18.0 release (2) @186ffe2
186ffe2 CHANGELOG: change log for v0.18.0 972fb46 src/goTools: update gopls latestVersion to 0.5.1 743aca1 docs: update documentation for Go status bar 222e0d0 package.json: recognize gopls.mod as a go.mod file c9b9618 src/debugAdapter: log all the env vars passed to dlv 4af2ecc src/goInstallTools: use the 'go' command from GOROOT/bin for tool install f0c87a6 src/util,goInstallTools: log 'cwd' b712568 src/goMain: change gopls_gc_details to gopls.gc_details 76e3f4c src/goLanguageServer: add survey config inspection commands b44ecdb Revert "src/goLanguageServer: enable survey for the go extension users" Change-Id: I7d62cf3518d7847b5c2dda52af4eacf3a933a6d3
2 parents 5a991c1 + 186ffe2 commit 6e0dbec

15 files changed

+168
-36
lines changed

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
## v0.18.0 - 23rd Oct, 2020
2+
3+
Unified Go status UI ⚡, many debugger feature improvements, and LSP 3.16 features! A list of all issues fixed with this release can be found in the [v0.18.0 milestone](https://github.com/golang/vscode-go/milestone/11).
4+
5+
### New Features
6+
- The new Go status bar provides a menu to manage the go version, open the gopls trace, open the `go.mod` file, and more. The old `Go Modules` status bar was removed in favor of this new unified status bar. See [VS Code Go UI documentation](https://github.com/golang/vscode-go/blob/master/docs/ui.md) to learn more about this.
7+
- New `Go: Toggle gc details` command toggles the display of compiler optimization choice for the open Go source file ([CL 256658](https://go-review.googlesource.com/c/vscode-go/+/256658)).
8+
- Upgraded LSP to [`3.16`](https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/#whatIsNew). Users of recent `gopls` can access new features such as [`Call hierarchy`](https://code.visualstudio.com/updates/v1_33#_call-hierarchy) and [`Semantic tokens`](https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#semantic-token-provider).
9+
10+
### Enhancement
11+
12+
- Debugging:
13+
* Correctly presents the reason when the debugged program stops due to `panic` and `fatal error` ([Issue 648](https://github.com/golang/vscode-go/issues/649)).
14+
* Be explicit about conditional breakpoint support ([Issue 781](https://github.com/golang/vscode-go/issues/781)).
15+
* Debug Adapter logs all the environment variables passed to dlv when verbose logging is enabled.
16+
- Language Server Client: sends `gopls` config as LSP initialization options for correct workspace symbols computation ([CL 259138](https://go-review.googlesource.com/c/vscode-go/+/259138)).
17+
- Snippets: adds a placeholder for the `for` statement snippet ([Issue 734](https://github.com/golang/vscode-go/issues/734)).
18+
- Excludes `vendor` directories from `go.inferGopath` disable mechanism ([Issue 301](https://github.com/golang/vscode-go/issues/301)).
19+
- New `go.logging.level` setting allows extra logging to help debugging extension issues ([CL 256557](https://go-review.googlesource.com/c/vscode-go/+/256557)).
20+
- For Nightly extension users, `Go: Show Survey Config` and `Go: Reset Survey Config` commands are available.
21+
22+
### Fixes
23+
- Fixed the bug that caused the debug adapter to leave bogus null items in the map type variable presentation ([Issue 199](https://github.com/golang/vscode-go/issues/199)).
24+
- Fixed several debug adapter bugs that caused remote debug to hang ([Issue 740](https://github.com/golang/vscode-go/issues/740), [766](https://github.com/golang/vscode-go/issues/766), [761](https://github.com/golang/vscode-go/issues/761), [764](https://github.com/golang/vscode-go/issues/764)).
25+
- Restored the correct handling of language server configuration change when users opt for enabling language server and installing `gopls`. ([CL 258997](https://go-review.googlesource.com/c/vscode-go/+/258997)).
26+
- Fixed a diagnostics error visualization issue when multiple files with errors are open ([Issue 743](https://github.com/golang/vscode-go/issues/743)).
27+
- Changed the dependency tool installation to use the `go` command chosen from the current `GOROOT/bin`. This helps avoid using a different version of `go` command for `asdf` or `direnv` users ([Issue 757](https://github.com/golang/vscode-go/issues/757)).
28+
29+
### Documentation
30+
- Documented the current limitation of symlink support in debugging ([CL 257204](https://go-review.googlesource.com/c/vscode-go/+/257204)), improved the instruction for CLI application debugging ([CL 259677](https://go-review.googlesource.com/c/vscode-go/+/259677)), and fixed syntax errors in example task configuration snippets ([CL 259077](https://go-review.googlesource.com/c/vscode-go/+/259077)).
31+
32+
### Code Health
33+
- Added an initial set of tests for debug adapters ([Issue 137](https://github.com/golang/vscode-go/issues/137)). We will keep working to improve our test coverage.
34+
35+
### Thanks
36+
37+
Thank you for your contributions, @suzmue, @vologab, @amitlevy21, @danielhelfand, @egonk, @quoctruong, @polinasok, @pjweinbgo, @stamblerre, @hyangah!
38+
139
## v0.17.2 - 29th Sep, 2020
240

341
### Fixes

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ You should immediately see a prompt in the bottom-right corner of your screen ti
6161

6262
If you see an error that looks like `command Go: Install/Update Tools not found`, it means that the extension has failed to activate and register its commands. Please uninstall and then reinstall the extension.
6363

64+
When the extension is active, you should see the [Go status bar](docs/ui.md) in the bottom left corner.
65+
6466
### Start coding
6567

6668
You're ready to Go!

docs/commands.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,11 @@ Restart the running instance of the language server
190190
### `Go: Choose Go Environment`
191191

192192
Choose a different Go version or binary for this project. (WIP)
193+
194+
### `Go: Show Survey Configuration`
195+
196+
Show the current Go survey configuration
197+
198+
### `Go: Reset Survey Configuration`
199+
200+
Reset the current Go survey configuration history

docs/go-version.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/images/gopls.png

7.76 KB
Loading

docs/images/selectGoVersion.png

253 KB
Loading

docs/images/statusbarmenu.png

185 KB
Loading

docs/ui.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Extension UI
2+
3+
## Using The Go Status Bar
4+
5+
The Go status bar appears in the lower left of the extension window. Clicking the Go status bar brings up a menu that provides easy access to see and update important information about your Go project. This includes information about the Go environment, the current Go version, the `gopls` trace, and about the current module.
6+
7+
<div style="text-align: center;"><img src="images/statusbarmenu.png" alt="vscode extension after Go status bar item is clicked" style="width:75%" > </div>
8+
9+
### Go Environment
10+
11+
The `Go Locate Configured Go Tools` command will display the configured GOPATH, GOROOT, tool locations and the results of `go env` in the output window.
12+
13+
### Managing Your Go Version
14+
15+
You can view the current Go version by looking at the status bar item in the bottom left corner of VS Code. Clicking this button and selecting `Choose Go Environment` will present you with a menu from which you can select any version of Go that exists in your $HOME/sdk directory or on <https://golang.org/dl>. This command is also available through the command pallette using `Go: Choose Go Environment`.
16+
17+
Previously, the `go.goroot` and `go.alternateTools` settings controlled the Go version used by VS Code Go. If you have configured these settings, they are no longer needed and should be deleted.
18+
19+
<div style="text-align: center;"><img src="images/selectGoVersion.png" alt="command pallete menu for selecting a new Go version" style="width:75%" > </div>
20+
21+
22+
The "Clear Selection" option resets your Go version to the one found first in either `go.alternateTools`, `go.goroot` or your PATH.
23+
24+
### Installing a New Go Version
25+
26+
After selecting any Go version that has not yet been installed (such as Go 1.14.6 in the screenshot above), the binary will be automatically installed in $HOME/sdk and put to use in your environment.
27+
28+
Once the download completes, VS Code Go will make use of this new Go version.
29+
30+
### Language Server Status
31+
32+
`gopls` is the official Go [language server](https://langserver.org/) developed by the Go team. It was developed in response to the release of [Go modules](docs/modules.md), and it is the recommended approach when working with [Go modules](docs/modules.md) in VS Code.
33+
34+
When `gopls` is enabled, :zap: is displayed next to the Go version in the status bar and the `gopls` version is displayed in the menu.
35+
36+
<div style="text-align: center;"><img src="images/gopls.png" alt="command pallete menu for selecting a new Go version" style="width:100px" > </div>
37+
38+
Selecting `Open 'gopls' trace` will open the trace of the `gopls` server in the output window. Please include this trace when filing an issue related to the extension and `gopls` is enabled.
39+
40+
### Modules Status
41+
42+
When modules are enabled for the file you have open, you can navigate to the `go.mod` file for the project using the menu. If you do not see the `Open go.mod` item, then the extension does not think the file you have open belongs to a module.
43+
44+
More information about [using Go modules](https://blog.golang.org/using-go-modules) is available on the Go blog.
45+

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@
111111
{
112112
"id": "go.mod",
113113
"extensions": [
114-
"go.mod"
114+
"go.mod",
115+
"gopls.mod"
115116
],
116117
"aliases": [
117118
"Go Module File"
@@ -365,6 +366,16 @@
365366
"command": "go.environment.choose",
366367
"title": "Go: Choose Go Environment",
367368
"description": "Choose a different Go version or binary for this project. (WIP)"
369+
},
370+
{
371+
"command": "go.survey.showConfig",
372+
"title": "Go: Show Survey Configuration",
373+
"description": "Show the current Go survey configuration"
374+
},
375+
{
376+
"command": "go.survey.resetConfig",
377+
"title": "Go: Reset Survey Configuration",
378+
"description": "Reset the current Go survey configuration history"
368379
}
369380
],
370381
"breakpoints": [

src/debugAdapter/goDebug.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import {
3838
getCurrentGoWorkspaceFromGOPATH,
3939
getInferredGopath,
4040
} from '../utils/pathUtils';
41-
import {killProcessTree} from '../utils/processUtils';
41+
import { killProcessTree } from '../utils/processUtils';
4242

4343
const fsAccess = util.promisify(fs.access);
4444
const fsUnlink = util.promisify(fs.unlink);
@@ -473,7 +473,11 @@ export class Delve {
473473
log(`Using GOPATH: ${env['GOPATH']}`);
474474
log(`Using GOROOT: ${this.goroot}`);
475475
log(`Using PATH: ${env['PATH']}`);
476-
476+
if (launchArgs.trace === 'verbose') {
477+
Object.keys(env).forEach((key) => {
478+
log(' export ' + key + '="' + env[key] + '"');
479+
});
480+
}
477481
if (!!launchArgs.noDebug) {
478482
if (mode === 'debug') {
479483
this.noDebug = true;
@@ -529,8 +533,7 @@ export class Delve {
529533

530534
if (!existsSync(launchArgs.dlvToolPath)) {
531535
log(
532-
`Couldn't find dlv at the Go tools path, ${process.env['GOPATH']}${
533-
env['GOPATH'] ? ', ' + env['GOPATH'] : ''
536+
`Couldn't find dlv at the Go tools path, ${process.env['GOPATH']}${env['GOPATH'] ? ', ' + env['GOPATH'] : ''
534537
} or ${envPath}`
535538
);
536539
return reject(

src/goInstallTools.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {
3939
GoVersion,
4040
rmdirRecursive,
4141
} from './util';
42-
import { envPath, getCurrentGoRoot, getToolFromToolPath, setCurrentGoRoot } from './utils/pathUtils';
42+
import { correctBinname, envPath, getCurrentGoRoot, getToolFromToolPath, setCurrentGoRoot } from './utils/pathUtils';
4343

4444
// declinedUpdates tracks the tools that the user has declined to update.
4545
const declinedUpdates: Tool[] = [];
@@ -201,6 +201,11 @@ export async function installTool(
201201
} else {
202202
envForTools['GO111MODULE'] = 'off';
203203
}
204+
// Some users use direnv-like setup where the choice of go is affected by
205+
// the current directory path. In order to avoid choosing a different go,
206+
// we will explicitly use `GOROOT/bin/go` instead of goVersion.binaryPath
207+
// (which can be a wrapper script that switches 'go').
208+
const goBinary = path.join(getCurrentGoRoot(), 'bin', correctBinname('go'));
204209

205210
// Build the arguments list for the tool installation.
206211
const args = ['get', '-v'];
@@ -231,8 +236,9 @@ export async function installTool(
231236
cwd: toolsTmpDir,
232237
};
233238
const execFile = util.promisify(cp.execFile);
234-
const { stdout, stderr } = await execFile(goVersion.binaryPath, args, opts);
239+
const { stdout, stderr } = await execFile(goBinary, args, opts);
235240
output = `${stdout} ${stderr}`;
241+
logVerbose(`install: %s %s\n%s%s`, goBinary, args.join(' '), stdout, stderr);
236242

237243
// TODO(rstambler): Figure out why this happens and maybe delete it.
238244
if (stderr.indexOf('unexpected directory layout:') > -1) {
@@ -368,7 +374,7 @@ export function updateGoVarsFromConfig(): Promise<void> {
368374
{ env: toolExecutionEnvironment(), cwd: getWorkspaceFolderPath() },
369375
(err, stdout, stderr) => {
370376
if (err) {
371-
outputChannel.append(`Failed to run '${goRuntimePath} env' : ${err}\n${stderr}`);
377+
outputChannel.append(`Failed to run '${goRuntimePath} env' (cwd: ${getWorkspaceFolderPath()}): ${err}\n${stderr}`);
372378
outputChannel.show();
373379

374380
vscode.window.showErrorMessage(`Failed to run '${goRuntimePath} env. The config change may not be applied correctly.`);

src/goLanguageServer.ts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import { GoDocumentSymbolProvider } from './goOutline';
4545
import { GoReferenceProvider } from './goReferences';
4646
import { GoRenameProvider } from './goRename';
4747
import { GoSignatureHelpProvider } from './goSignature';
48-
import { updateLanguageServerIconGoStatusBar } from './goStatus';
48+
import { outputChannel, updateLanguageServerIconGoStatusBar } from './goStatus';
4949
import { GoCompletionItemProvider } from './goSuggest';
5050
import { GoWorkspaceSymbolProvider } from './goSymbol';
5151
import { getTool, Tool } from './goTools';
@@ -86,6 +86,10 @@ let defaultLanguageProviders: vscode.Disposable[] = [];
8686
// server.
8787
let restartCommand: vscode.Disposable;
8888

89+
// When enabled, users may be prompted to fill out the gopls survey.
90+
// For now, we turn it on in the Nightly extension to test it.
91+
const goplsSurveyOn: boolean = extensionId === 'golang.go-nightly';
92+
8993
// lastUserAction is the time of the last user-triggered change.
9094
// A user-triggered change is a didOpen, didChange, didSave, or didClose event.
9195
let lastUserAction: Date = new Date();
@@ -138,7 +142,7 @@ function scheduleGoplsSuggestions(tool: Tool) {
138142
setTimeout(survey, timeDay);
139143

140144
const cfg = buildLanguageServerConfig();
141-
if (!cfg.enabled) {
145+
if (!goplsSurveyOn || !cfg.enabled) {
142146
return;
143147
}
144148
maybePromptForGoplsSurvey();
@@ -1001,8 +1005,31 @@ function getSurveyConfig(): SurveyConfig {
10011005
}
10021006
}
10031007

1008+
export async function showSurveyConfig() {
1009+
outputChannel.appendLine('Gopls Survey Configuration');
1010+
outputChannel.appendLine(JSON.stringify(getSurveyConfig(), null, 2));
1011+
outputChannel.show();
1012+
1013+
const selected = await vscode.window.showInformationMessage(`Maybe prompt for survey?`, 'Yes', 'No');
1014+
switch (selected) {
1015+
case 'Yes':
1016+
maybePromptForGoplsSurvey();
1017+
break;
1018+
default:
1019+
break;
1020+
}
1021+
}
1022+
1023+
export function resetSurveyConfig() {
1024+
flushSurveyConfig(null);
1025+
}
1026+
10041027
function flushSurveyConfig(cfg: SurveyConfig) {
1005-
updateGlobalState(goplsSurveyConfig, JSON.stringify(cfg));
1028+
if (cfg) {
1029+
updateGlobalState(goplsSurveyConfig, JSON.stringify(cfg));
1030+
} else {
1031+
updateGlobalState(goplsSurveyConfig, null); // reset
1032+
}
10061033
}
10071034

10081035
// errorKind refers to the different possible kinds of gopls errors.

src/goMain.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import {
3434
import {
3535
languageServerIsRunning,
3636
promptForLanguageServerDefaultChange,
37+
resetSurveyConfig,
38+
showSurveyConfig,
3739
startLanguageServerWithFallback, watchLanguageServerConfiguration
3840
} from './goLanguageServer';
3941
import { lintCode } from './goLint';
@@ -462,7 +464,7 @@ export function activate(ctx: vscode.ExtensionContext) {
462464
}
463465
vscode.commands.executeCommand('gc_details', doc)
464466
.then(undefined, (reason0) => {
465-
vscode.commands.executeCommand('gopls_gc_details', doc)
467+
vscode.commands.executeCommand('gopls.gc_details', doc)
466468
.then(undefined, (reason1) => {
467469
vscode.window.showErrorMessage(`"Go: Toggle gc details" command failed: gc_details:${reason0} gopls_gc_details:${reason1}`);
468470
});
@@ -507,6 +509,12 @@ export function activate(ctx: vscode.ExtensionContext) {
507509
})
508510
);
509511

512+
// Survey related commands
513+
ctx.subscriptions.push(
514+
vscode.commands.registerCommand('go.survey.showConfig', () => showSurveyConfig()));
515+
ctx.subscriptions.push(
516+
vscode.commands.registerCommand('go.survey.resetConfig', () => resetSurveyConfig()));
517+
510518
vscode.languages.setLanguageConfiguration(GO_MODE.language, {
511519
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
512520
});

src/goTools.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,10 @@ export const allToolsInformation: { [key: string]: Tool } = {
341341
isImportant: false,
342342
description: 'Language Server from Google',
343343
minimumGoVersion: semver.coerce('1.12'),
344-
latestVersion: semver.coerce('0.4.1'),
345-
latestVersionTimestamp: moment('2020-05-13', 'YYYY-MM-DD'),
346-
latestPrereleaseVersion: semver.coerce('0.4.1'),
347-
latestPrereleaseVersionTimestamp: moment('2020-05-13', 'YYYY-MM-DD'),
344+
latestVersion: semver.coerce('0.5.1'),
345+
latestVersionTimestamp: moment('2020-09-30', 'YYYY-MM-DD'),
346+
latestPrereleaseVersion: semver.coerce('0.5.1'),
347+
latestPrereleaseVersionTimestamp: moment('2020-09-30', 'YYYY-MM-DD'),
348348
},
349349
'dlv': {
350350
name: 'dlv',

src/util.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,12 @@ export async function getGoVersion(goBinPath?: string): Promise<GoVersion | unde
348348
}
349349
warn(`cached Go version (${JSON.stringify(cachedGoVersion)}) is invalid, recomputing`);
350350
}
351+
const docUri = vscode.window.activeTextEditor?.document.uri;
352+
const cwd = getWorkspaceFolderPath(docUri && docUri.fsPath.endsWith('.go') ? docUri : undefined);
353+
351354
let goVersion: GoVersion;
352355
try {
353356
const env = toolExecutionEnvironment();
354-
const docUri = vscode.window.activeTextEditor?.document.uri;
355-
const cwd = getWorkspaceFolderPath(docUri && docUri.fsPath.endsWith('.go') ? docUri : undefined);
356357
const execFile = util.promisify(cp.execFile);
357358
const { stdout, stderr } = await execFile(goRuntimePath, ['version'], { env, cwd });
358359
if (stderr) {
@@ -361,7 +362,7 @@ export async function getGoVersion(goBinPath?: string): Promise<GoVersion | unde
361362
}
362363
goVersion = new GoVersion(goRuntimePath, stdout);
363364
} catch (err) {
364-
warn(`failed to run "${goRuntimePath} version": ${err}`);
365+
warn(`failed to run "${goRuntimePath} version": ${err} cwd: ${cwd}`);
365366
return;
366367
}
367368
if (!goBinPath) { // if getGoVersion was called with a given goBinPath, don't cache the result.

0 commit comments

Comments
 (0)