Skip to content

Commit 5bc3c1a

Browse files
committed
merge with golang/vscode-goo
2 parents 95c38f7 + d60e8c1 commit 5bc3c1a

16 files changed

+285
-1611
lines changed

.github/workflows/ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: build
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
GOPATH: /tmp/go
7+
# Because some tests require explicit setting of GOPATH. TODO: FIX THEM.
8+
9+
jobs:
10+
build:
11+
name: ${{ matrix.os }} ${{ matrix.version }}
12+
runs-on: ${{ matrix.os }}
13+
14+
if: "!contains(github.event.head_commit.message, 'SKIP CI')"
15+
timeout-minutes: 20
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest]
20+
version: ['stable']
21+
22+
steps:
23+
- name: Clone repository
24+
uses: actions/checkout@v1
25+
26+
- name: Setup Node
27+
uses: actions/setup-node@v1
28+
with:
29+
node-version: '10.x'
30+
31+
- name: Setup Go
32+
uses: actions/setup-go@v1
33+
with:
34+
go-version: '1.14'
35+
36+
- name: Install dependencies
37+
run: npm install
38+
39+
- name: Compile
40+
run: npm run vscode:prepublish
41+
42+
- name: Install Go tools (Modules mode)
43+
run: |
44+
go version
45+
go get github.com/acroca/go-symbols \
46+
github.com/davidrjenni/reftools/cmd/fillstruct \
47+
github.com/haya14busa/goplay/cmd/goplay \
48+
github.com/mdempsky/gocode \
49+
github.com/sqs/goreturns \
50+
github.com/uudashr/gopkgs/v2/cmd/gopkgs \
51+
github.com/zmb3/gogetdoc \
52+
golang.org/x/lint/golint \
53+
golang.org/x/tools/cmd/gorename
54+
env:
55+
GO111MODULE: on
56+
57+
- name: Install Go tools (GOPATH mode)
58+
run: |
59+
go version
60+
go get github.com/cweill/gotests/... \
61+
github.com/rogpeppe/godef \
62+
github.com/ramya-rao-a/go-outline
63+
# Because some tests depend on the source code checked in GOPATH. TODO: FIX THEM.
64+
env:
65+
GO111MODULE: off
66+
67+
- name: Run unit tests
68+
run: npm run unit-test
69+
continue-on-error: true
70+
71+
- name: Run tests
72+
uses: GabrielBB/[email protected]
73+
with:
74+
run: npm run test
75+
env:
76+
CODE_VERSION: ${{ matrix.version }}
77+
continue-on-error: ${{ matrix.version == 'insiders' }}
78+
79+
eslint:
80+
runs-on: ubuntu-latest
81+
if: "!contains(github.event.head_commit.message, 'SKIP CI')"
82+
83+
steps:
84+
- name: Clone repository
85+
uses: actions/checkout@v1
86+
87+
- name: Setup Node
88+
uses: actions/setup-node@v1
89+
with:
90+
node-version: '10.x'
91+
92+
- name: Install Dependencies
93+
run: 'npm install --frozen-lockfile'
94+
shell: bash
95+
96+
- name: Lint check
97+
run: npm run lint

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ language: go
33
dist: bionic
44

55
go:
6-
- 1.11.x
76
- 1.12.x
87
- 1.13.x
8+
- 1.14.x
99
- tip
1010

1111
git:

CHANGELOG.md

Lines changed: 5 additions & 1511 deletions
Large diffs are not rendered by default.

METADATA

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "vscode-go"
2+
description:
3+
"Fork of github.com/Microsoft/vscode-go (the VSCode plugin for Go). "
4+
"This fork is kept in sync with the upstream while includes "
5+
"new features [email protected] team is developing and experimenting. "
6+
""
7+
8+
third_party {
9+
url {
10+
type: GIT
11+
value: "https://github.com/Microsoft/vscode-go"
12+
}
13+
version: "master"
14+
last_upgrade_date { year: 2020 month: 1 day: 8 }
15+
license_type: NOTICE
16+
}

README.md

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
# Go for Visual Studio Code
2-
3-
[![Join the chat at https://gitter.im/Microsoft/vscode-go](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/vscode-go?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/Microsoft/vscode-go.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-go)
4-
5-
This extension adds rich language support for the [Go language](https://golang.org/) to VS Code.
6-
7-
Read the [Changelog](https://github.com/Microsoft/vscode-go/blob/master/CHANGELOG.md) to know what has changed over the last few versions of this extension.
1+
# Go Nightly for VS Code
2+
3+
> ### **ATTENTION**
4+
>**Go Nightly for VS Code** is the insider version of
5+
[VS Code Go extension](https://github.com/microsoft/vscode-go)
6+
for early feedback and testing. This extension works best with
7+
[VS Code Insiders](https://code.visualstudio.com/insiders).
8+
Go Nightly contains previews of new features and bug fixes that are still
9+
under review or testing, so can be unstable. If you are looking for the stable version,
10+
please use [the stable version](https://marketplace.visualstudio.com/items?itemName=ms-vscode.go) instead.
11+
>
12+
> **NOTE:**
13+
If you have both stable (aka "Go") and nightly version (aka "Go Nightly") installed,
14+
you MUST DISABLE one of them. Docs on how to disable an extension can be found
15+
[here](https://code.visualstudio.com/docs/editor/extension-gallery#_disable-an-extension).
16+
17+
> ### Difference between VS Code Go and VS Code Go Nightly
18+
> - Go Nightly is maintained and released by Go Tools team at Google.
19+
> - Go Nightly is released more frequently than the stable version.
20+
> - Go Nightly includes features and bug fixes that are still under testing or not finalized yet.
21+
> - Go Nightly may use the latest pre-release versions of tools (e.g. `gopls`) instead of release versions.
22+
> - For now, Go and Go Nightly maintain separate repositories. Both repositories
23+
> welcome all contributors. For contribution to Go Nightly repo, see the Go
24+
> project's [contribution guide](https://golang.org/doc/contribute.html).
25+
> Go team members who has signed the Microsoft CLA will send a syncing PR upstream to
26+
> https://github.com/microsoft/vscode-go every two weeks.
27+
> - [Here](https://github.com/microsoft/vscode-go/compare/master...golang:master) is the full list of local modifications.
828
929
## Table of Contents
1030

@@ -36,16 +56,16 @@ Read the [Changelog](https://github.com/Microsoft/vscode-go/blob/master/CHANGELO
3656

3757
### IntelliSense
3858

39-
- Auto Completion of symbols as you type (using `gocode`)
40-
- Signature Help for functions as you type (using `gogetdoc` or `godef`+`go doc`)
41-
- Quick Info on the symbol as you hover over it (using `gogetdoc` or `godef`+`go doc`)
59+
- Auto Completion of symbols as you type (using language server or `gocode`)
60+
- Signature Help for functions as you type (using language server or `gogetdoc` or `godef`+`go doc`)
61+
- Quick Info on the symbol as you hover over it (using language server or `gogetdoc` or `godef`+`go doc`)
4262

4363
### Code Navigation
4464

45-
- Go to or Peek Definition of symbols (using `gogetdoc` or `godef`+`go doc`)
46-
- Find References of symbols and Implementations of interfaces (using `guru`)
65+
- Go to or Peek Definition of symbols (using language server or `gogetdoc` or `godef`+`go doc`)
66+
- Find References of symbols and Implementations of interfaces (using language server or `guru`)
4767
- Go to symbol in file or see the file outline (using `go-outline`)
48-
- Go to symbol in workspace (using `go-symbols`)
68+
- Go to symbol in workspace (using language server or `go-symbols`)
4969
- Toggle between a Go program and the corresponding test file.
5070

5171
### Code Editing
@@ -93,7 +113,7 @@ You will see `Analysis Tools Missing` in the bottom right, clicking this will of
93113

94114
**Note 2**: The `Format on save` feature has a timeout of 750ms after which the formatting is aborted. You can change this timeout using the setting `editor.formatOnSaveTimeout`. This feature gets disabled when you have enabled the `Auto Save` feature in Visual Studio Code.
95115

96-
**Note 3**: This extension uses `gocode` to provide completion lists as you type. If you have disabled the `go.buildOnSave` setting, then you may not get fresh results from not-yet-built dependencies. Therefore, ensure you have built your dependencies manually in such cases.
116+
**Note 3**: Unless `go.useLanguageServer` is set to `true`, this extension uses `gocode` to provide completion lists as you type. If you have disabled the `go.buildOnSave` setting, then you may not get fresh results from not-yet-built dependencies. Therefore, ensure you have built your dependencies manually in such cases.
97117

98118
### Customizing the Go extension features
99119

@@ -117,7 +137,7 @@ Previously, we added support to use `go-langserver`, the [language server from S
117137

118138
Ideally, you would see prompts to use/install/update the language server.
119139
Follow the prompts and the language server should get set up correctly.
120-
If you want to manually install/update the language server,
140+
If you want to manually install/update the language server,
121141
- Ensure you have set `go.useLanguageServer` to `true` in your settings
122142
- Use the `Go: Install/Update Tools` command, select `gopls` from the list and press Ok.
123143

@@ -126,7 +146,8 @@ If you want to manually install/update the language server,
126146

127147
Below are the settings you can use to control the use of the language server. You need to reload the VS Code window for any changes in these settings to take effect.
128148

129-
- Set `go.useLanguageServer` to `true` to enable the use of language server
149+
- Set `go.useLanguageServer` to `true` to enable the use of language server.
150+
- When using `gopls`, see the [recommended settings](https://github.com/golang/tools/blob/master/gopls/doc/vscode.md).
130151
- Some of the features from the language server can be disabled if needed using the setting `go.languageServerExperimentalFeatures`. Below are the features you can thus control. By default, all are set to `true` i.e are enabled.
131152
```json
132153
"go.languageServerExperimentalFeatures": {

build/cloudbuild.container.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
steps:
2+
- name: 'gcr.io/cloud-builders/docker'
3+
args: ['build', '-t', 'gcr.io/$PROJECT_ID/vscode-test-env', '-f', 'build/Dockerfile', '.']
4+
images:
5+
- 'gcr.io/$PROJECT_ID/vscode-test-env'

build/cloudbuild.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
steps:
2+
- name: 'gcr.io/$PROJECT_ID/vscode-test-env'
3+
entrypoint: "./build/all.bash"
4+
args: ['ci']
5+
env:
6+
- 'BUILD=$BUILD_ID'
7+
- 'PROJECT=$PROJECT_ID'
8+
- 'REV=$REVISION_ID'
9+
timeout: 600s

package-lock.json

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
2-
"name": "Go",
3-
"version": "0.12.0",
4-
"publisher": "ms-vscode",
5-
"description": "Rich Go language support for Visual Studio Code",
2+
"name": "go-nightly",
3+
"displayName": "Go Nightly",
4+
"version": "2020.3.144",
5+
"publisher": "golang",
6+
"description": "Rich Go language support for Visual Studio Code (Nightly)",
67
"author": {
7-
"name": "Microsoft Corporation - Development Labs"
8+
"name": "Go Team at Google"
89
},
10+
"preview": true,
911
"license": "MIT",
1012
"icon": "images/go-logo-blue.png",
1113
"categories": [
@@ -22,7 +24,10 @@
2224
"private": true,
2325
"repository": {
2426
"type": "git",
25-
"url": "https://github.com/Microsoft/vscode-go.git"
27+
"url": "https://github.com/golang/vscode-go"
28+
},
29+
"bugs": {
30+
"url": "https://github.com/golang/vscode-go/issues"
2631
},
2732
"keywords": [
2833
"multi-root ready"
@@ -47,7 +52,7 @@
4752
"vscode-debugadapter": "^1.36.0",
4853
"vscode-debugprotocol": "^1.36.0",
4954
"vscode-extension-telemetry": "^0.1.2",
50-
"vscode-languageclient": "^6.0.1",
55+
"vscode-languageclient": "6.1.0",
5156
"web-request": "^1.0.7"
5257
},
5358
"devDependencies": {
@@ -66,7 +71,7 @@
6671
"prettier": "^1.16.4"
6772
},
6873
"engines": {
69-
"vscode": "^1.30.0"
74+
"vscode": "^1.41.0"
7075
},
7176
"activationEvents": [
7277
"workspaceContains:**/*.go",
@@ -326,7 +331,11 @@
326331
"description": "Restart the running instance of the language server"
327332
}
328333
],
329-
"breakpoints": [{ "language": "go" }],
334+
"breakpoints": [
335+
{
336+
"language": "go"
337+
}
338+
],
330339
"debuggers": [
331340
{
332341
"type": "go",

src/goInstallTools.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import {
2020
getTool,
2121
hasModSuffix,
2222
isGocode,
23-
Tool
23+
Tool,
24+
containsString
2425
} from './goTools';
2526
import {
2627
getBinPath,
@@ -41,7 +42,13 @@ const declinedInstalls: Tool[] = [];
4142

4243
export async function installAllTools(updateExistingToolsOnly: boolean = false) {
4344
const goVersion = await getGoVersion();
44-
const allTools = getConfiguredTools(goVersion);
45+
let allTools = getConfiguredTools(goVersion);
46+
47+
// exclude tools replaced by alternateTools.
48+
const alternateTools: { [key: string]: string } = getGoConfig().get('alternateTools');
49+
allTools = allTools.filter((tool) => {
50+
return !alternateTools[tool.name];
51+
});
4552

4653
// Update existing tools by finding all tools the user has already installed.
4754
if (updateExistingToolsOnly) {
@@ -275,6 +282,9 @@ export function installTools(missing: Tool[], goVersion: GoVersion): Promise<voi
275282
const failures = res.filter((x) => x != null);
276283
if (failures.length === 0) {
277284
outputChannel.appendLine('All tools successfully installed. You are ready to Go :).');
285+
if (containsString(missing, 'gopls')) {
286+
vscode.commands.executeCommand('go.languageserver.restart');
287+
}
278288
return;
279289
}
280290

@@ -314,7 +324,6 @@ export async function promptForMissingTool(toolName: string) {
314324
return;
315325
}
316326
}
317-
318327
const installOptions = ['Install'];
319328
let missing = await getMissingTools(goVersion);
320329
if (!containsTool(missing, tool)) {

0 commit comments

Comments
 (0)