Skip to content

Commit

Permalink
merge with golang/vscode-goo
Browse files Browse the repository at this point in the history
  • Loading branch information
stamblerre committed Mar 12, 2020
2 parents 95c38f7 + d60e8c1 commit 5bc3c1a
Show file tree
Hide file tree
Showing 16 changed files with 285 additions and 1,611 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: build

on: [push, pull_request]

env:
GOPATH: /tmp/go
# Because some tests require explicit setting of GOPATH. TODO: FIX THEM.

jobs:
build:
name: ${{ matrix.os }} ${{ matrix.version }}
runs-on: ${{ matrix.os }}

if: "!contains(github.event.head_commit.message, 'SKIP CI')"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
version: ['stable']

steps:
- name: Clone repository
uses: actions/checkout@v1

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'

- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: '1.14'

- name: Install dependencies
run: npm install

- name: Compile
run: npm run vscode:prepublish

- name: Install Go tools (Modules mode)
run: |
go version
go get github.com/acroca/go-symbols \
github.com/davidrjenni/reftools/cmd/fillstruct \
github.com/haya14busa/goplay/cmd/goplay \
github.com/mdempsky/gocode \
github.com/sqs/goreturns \
github.com/uudashr/gopkgs/v2/cmd/gopkgs \
github.com/zmb3/gogetdoc \
golang.org/x/lint/golint \
golang.org/x/tools/cmd/gorename
env:
GO111MODULE: on

- name: Install Go tools (GOPATH mode)
run: |
go version
go get github.com/cweill/gotests/... \
github.com/rogpeppe/godef \
github.com/ramya-rao-a/go-outline
# Because some tests depend on the source code checked in GOPATH. TODO: FIX THEM.
env:
GO111MODULE: off

- name: Run unit tests
run: npm run unit-test
continue-on-error: true

- name: Run tests
uses: GabrielBB/[email protected]
with:
run: npm run test
env:
CODE_VERSION: ${{ matrix.version }}
continue-on-error: ${{ matrix.version == 'insiders' }}

eslint:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'SKIP CI')"

steps:
- name: Clone repository
uses: actions/checkout@v1

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'

- name: Install Dependencies
run: 'npm install --frozen-lockfile'
shell: bash

- name: Lint check
run: npm run lint
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ language: go
dist: bionic

go:
- 1.11.x
- 1.12.x
- 1.13.x
- 1.14.x
- tip

git:
Expand Down
1,516 changes: 5 additions & 1,511 deletions CHANGELOG.md

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions METADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "vscode-go"
description:
"Fork of github.com/Microsoft/vscode-go (the VSCode plugin for Go). "
"This fork is kept in sync with the upstream while includes "
"new features [email protected] team is developing and experimenting. "
""

third_party {
url {
type: GIT
value: "https://github.com/Microsoft/vscode-go"
}
version: "master"
last_upgrade_date { year: 2020 month: 1 day: 8 }
license_type: NOTICE
}
53 changes: 37 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
# Go for Visual Studio Code

[![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)

This extension adds rich language support for the [Go language](https://golang.org/) to VS Code.

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.
# Go Nightly for VS Code

> ### **ATTENTION**
>**Go Nightly for VS Code** is the insider version of
[VS Code Go extension](https://github.com/microsoft/vscode-go)
for early feedback and testing. This extension works best with
[VS Code Insiders](https://code.visualstudio.com/insiders).
Go Nightly contains previews of new features and bug fixes that are still
under review or testing, so can be unstable. If you are looking for the stable version,
please use [the stable version](https://marketplace.visualstudio.com/items?itemName=ms-vscode.go) instead.
>
> **NOTE:**
If you have both stable (aka "Go") and nightly version (aka "Go Nightly") installed,
you MUST DISABLE one of them. Docs on how to disable an extension can be found
[here](https://code.visualstudio.com/docs/editor/extension-gallery#_disable-an-extension).

> ### Difference between VS Code Go and VS Code Go Nightly
> - Go Nightly is maintained and released by Go Tools team at Google.
> - Go Nightly is released more frequently than the stable version.
> - Go Nightly includes features and bug fixes that are still under testing or not finalized yet.
> - Go Nightly may use the latest pre-release versions of tools (e.g. `gopls`) instead of release versions.
> - For now, Go and Go Nightly maintain separate repositories. Both repositories
> welcome all contributors. For contribution to Go Nightly repo, see the Go
> project's [contribution guide](https://golang.org/doc/contribute.html).
> Go team members who has signed the Microsoft CLA will send a syncing PR upstream to
> https://github.com/microsoft/vscode-go every two weeks.
> - [Here](https://github.com/microsoft/vscode-go/compare/master...golang:master) is the full list of local modifications.
## Table of Contents

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

### IntelliSense

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

### Code Navigation

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

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

**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.

**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.
**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.

### Customizing the Go extension features

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

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

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

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.

- Set `go.useLanguageServer` to `true` to enable the use of language server
- Set `go.useLanguageServer` to `true` to enable the use of language server.
- When using `gopls`, see the [recommended settings](https://github.com/golang/tools/blob/master/gopls/doc/vscode.md).
- 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.
```json
"go.languageServerExperimentalFeatures": {
Expand Down
5 changes: 5 additions & 0 deletions build/cloudbuild.container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/vscode-test-env', '-f', 'build/Dockerfile', '.']
images:
- 'gcr.io/$PROJECT_ID/vscode-test-env'
9 changes: 9 additions & 0 deletions build/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
steps:
- name: 'gcr.io/$PROJECT_ID/vscode-test-env'
entrypoint: "./build/all.bash"
args: ['ci']
env:
- 'BUILD=$BUILD_ID'
- 'PROJECT=$PROJECT_ID'
- 'REV=$REVISION_ID'
timeout: 600s
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 18 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"name": "Go",
"version": "0.12.0",
"publisher": "ms-vscode",
"description": "Rich Go language support for Visual Studio Code",
"name": "go-nightly",
"displayName": "Go Nightly",
"version": "2020.3.144",
"publisher": "golang",
"description": "Rich Go language support for Visual Studio Code (Nightly)",
"author": {
"name": "Microsoft Corporation - Development Labs"
"name": "Go Team at Google"
},
"preview": true,
"license": "MIT",
"icon": "images/go-logo-blue.png",
"categories": [
Expand All @@ -22,7 +24,10 @@
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-go.git"
"url": "https://github.com/golang/vscode-go"
},
"bugs": {
"url": "https://github.com/golang/vscode-go/issues"
},
"keywords": [
"multi-root ready"
Expand All @@ -47,7 +52,7 @@
"vscode-debugadapter": "^1.36.0",
"vscode-debugprotocol": "^1.36.0",
"vscode-extension-telemetry": "^0.1.2",
"vscode-languageclient": "^6.0.1",
"vscode-languageclient": "6.1.0",
"web-request": "^1.0.7"
},
"devDependencies": {
Expand All @@ -66,7 +71,7 @@
"prettier": "^1.16.4"
},
"engines": {
"vscode": "^1.30.0"
"vscode": "^1.41.0"
},
"activationEvents": [
"workspaceContains:**/*.go",
Expand Down Expand Up @@ -326,7 +331,11 @@
"description": "Restart the running instance of the language server"
}
],
"breakpoints": [{ "language": "go" }],
"breakpoints": [
{
"language": "go"
}
],
"debuggers": [
{
"type": "go",
Expand Down
15 changes: 12 additions & 3 deletions src/goInstallTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {
getTool,
hasModSuffix,
isGocode,
Tool
Tool,
containsString
} from './goTools';
import {
getBinPath,
Expand All @@ -41,7 +42,13 @@ const declinedInstalls: Tool[] = [];

export async function installAllTools(updateExistingToolsOnly: boolean = false) {
const goVersion = await getGoVersion();
const allTools = getConfiguredTools(goVersion);
let allTools = getConfiguredTools(goVersion);

// exclude tools replaced by alternateTools.
const alternateTools: { [key: string]: string } = getGoConfig().get('alternateTools');
allTools = allTools.filter((tool) => {
return !alternateTools[tool.name];
});

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

Expand Down Expand Up @@ -314,7 +324,6 @@ export async function promptForMissingTool(toolName: string) {
return;
}
}

const installOptions = ['Install'];
let missing = await getMissingTools(goVersion);
if (!containsTool(missing, tool)) {
Expand Down
Loading

0 comments on commit 5bc3c1a

Please sign in to comment.