Skip to content

Commit

Permalink
extension: move extension code to a separate module
Browse files Browse the repository at this point in the history
The vscgo command line tool is moved to the repo root module.
This simplifies the release process.

The extension module is meant to be used only for development
and majority of the code is non-Go code.

src/goInstallTools.ts installVSCGO is modified too -
Nightly installs with @master.

Updates #3122
Updates #3121

Change-Id: I04e441ecac71b4ab42e635835d91dcf344353e67
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/554316
Reviewed-by: Suzy Mueller <suzmue@golang.org>
Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Commit-Queue: Hyang-Ah Hana Kim <hyangah@gmail.com>
  • Loading branch information
hyangah authored and gopherbot committed Jan 11, 2024
1 parent b01b0b7 commit 690cf2e
Show file tree
Hide file tree
Showing 282 changed files with 705 additions and 598 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/test-long-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: './extension/package-lock.json'

- name: Setup Go
uses: actions/setup-go@v4
Expand All @@ -38,34 +39,41 @@ jobs:

- name: Install dependencies
run: npm ci
working-directory: ./extension

- name: Compile
run: npm run vscode:prepublish
working-directory: ./extension

- name: Install Go tools (Modules mode)
run: |
go version
go run ./tools/installtools/main.go
go run ./tools/installtools/main.Go
working-directory: ./extension
env:
GO111MODULE: on
EXT: "${{ matrix.os == 'windows-latest' && '.exe' || ''}}"

- name: Run unit tests
run: npm run unit-test
working-directory: ./extension

- name: Run tests (Linux)
run: xvfb-run -a npm run test
working-directory: ./extension
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
CODE_VERSION: ${{ matrix.version }}
VSCODEGO_BEFORE_RELEASE_TESTS: true
- name: Run tests (Windows/Mac)
run: npm run test
working-directory: ./extension
if: ${{ matrix.os != 'ubuntu-latest' }}
env:
CODE_VERSION: ${{ matrix.version }}
VSCODEGO_BEFORE_RELEASE_TESTS: true

- name: Lint check
run: npm run lint
working-directory: ./extension
if: ${{ matrix.os == 'ubuntu-latest' && matrix.version == 'stable' }}
8 changes: 8 additions & 0 deletions .github/workflows/test-long.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: './extension/package-lock.json'

- name: Setup Go
uses: actions/setup-go@v4
Expand All @@ -37,32 +38,39 @@ jobs:

- name: Install dependencies
run: npm ci
working-directory: ./extension

- name: Compile
run: npm run vscode:prepublish
working-directory: ./extension

- name: Install Go tools (Modules mode)
run: |
go version
go run ./tools/installtools/main.go
working-directory: ./extension
env:
GO111MODULE: on
EXT: "${{ matrix.os == 'windows-latest' && '.exe' || ''}}"

- name: Run unit tests
run: npm run unit-test
working-directory: ./extension

- name: Run tests (Linux)
run: xvfb-run -a npm run test
working-directory: ./extension
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
CODE_VERSION: ${{ matrix.version }}
- name: Run tests (Windows/Mac)
run: npm run test
working-directory: ./extension
if: ${{ matrix.os != 'ubuntu-latest' }}
env:
CODE_VERSION: ${{ matrix.version }}

- name: Lint check
run: npm run lint
working-directory: ./extension
if: ${{ matrix.os == 'ubuntu-latest' && matrix.version == 'stable' }}
8 changes: 8 additions & 0 deletions .github/workflows/test-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: './extension/package-lock.json'

- name: Setup Go
uses: actions/setup-go@v4
Expand All @@ -36,32 +37,39 @@ jobs:

- name: Install dependencies
run: npm ci
working-directory: ./extension

- name: Compile
run: npm run vscode:prepublish
working-directory: ./extension

- name: Install Go tools (Modules mode)
run: |
go version
go run ./tools/installtools/main.go
working-directory: ./extension
env:
GO111MODULE: on
EXT: "${{ matrix.os == 'windows-latest' && '.exe' || ''}}"

- name: Run unit tests
run: npm run unit-test
working-directory: ./extension

- name: Run tests (Linux)
run: xvfb-run -a npm run test
working-directory: ./extension
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
CODE_VERSION: ${{ matrix.version }}
- name: Run tests (Windows/Mac)
run: npm run test
working-directory: ./extension
if: ${{ matrix.os != 'ubuntu-latest' }}
env:
CODE_VERSION: ${{ matrix.version }}

- name: Lint check
run: npm run lint
working-directory: ./extension
if: ${{ matrix.os == 'ubuntu-latest' && matrix.version == 'stable' }}
3 changes: 0 additions & 3 deletions .prettierrc.js

This file was deleted.

50 changes: 15 additions & 35 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/tools/generate.go",
"cwd": "${workspaceFolder}"
"program": "${workspaceFolder}/extension/tools/generate.go",
"cwd": "${workspaceFolder}/extension"
},
{
"name": "Launch Extension",
Expand All @@ -20,29 +20,15 @@
"--disable-extensions"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
"${workspaceFolder}/extension/dist/**/*.js"
],
"sourceMaps": true,
"smartStep": true,
"preLaunchTask": "npm: bundle-dev",
"env": {
"VSCODE_GO_IN_TEST": "" // Enable code
},
},
{
"name": "Launch as server",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/dist/debugAdapter.js",
"args": [
"--server=4711"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"sourceMaps": true,
"smartStep": true,
"preLaunchTask": "npm: bundle-dev"
"cwd": "${workspaceFolder}/extension"
},
{
"name": "Launch Extension Tests",
Expand All @@ -53,9 +39,9 @@
"args": [
"--disable-extensions",
"--profile-temp",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/integration/index",
"--user-data-dir=${workspaceFolder}/.user-data-dir-test",
"--extensionDevelopmentPath=${workspaceFolder}/extension",
"--extensionTestsPath=${workspaceFolder}/extension/out/test/integration/index",
"--user-data-dir=${workspaceFolder}/extension/.user-data-dir-test",
"--timeout",
"999999"
],
Expand All @@ -66,6 +52,7 @@
"sourceMaps": true,
"smartStep": true,
"preLaunchTask": "npm: watch",
"cwd": "${workspaceFolder}/extension"
},
{
"name": "Launch Extension Tests with Gopls",
Expand All @@ -76,41 +63,34 @@
"args": [
"--disable-extensions",
"--profile-temp",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/gopls/index",
"--user-data-dir=${workspaceFolder}/.user-data-dir-test",
"--extensionDevelopmentPath=${workspaceFolder}/extension",
"--extensionTestsPath=${workspaceFolder}/extension/out/test/gopls/index",
"--user-data-dir=${workspaceFolder}/extension/.user-data-dir-test",
"--timeout", "999999",
],
"env": {
"VSCODE_GO_IN_TEST": "1" // Disable code that shouldn't be used in test
},
"sourceMaps": true,
"preLaunchTask": "npm: watch",
"cwd": "${workspaceFolder}/extension"
},
{
"type": "node",
"request": "launch",
"name": "Launch Unit Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"program": "${workspaceFolder}/extension/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"5000",
"--colors",
"${workspaceFolder}/out/test/unit"
"${workspaceFolder}/extension/out/test/unit"
],
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "npm: watch",
"cwd": "${workspaceFolder}/extension"
},
],
"compounds": [
{
"name": "Extension + Debug server",
"configurations": [
"Launch Extension",
"Launch as server"
]
}
]
}
17 changes: 11 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": true,
"typings": false
"**/out": true,
"**/.vscode-test": true,
"**/.user-data-dir-test": true,
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"out/": true
"node_modules": true,
"out": true,
"dist": true,
".vscode-test": true,
".user-data-dir-test": true,
},
"editor.insertSpaces": false,
"typescript.tsdk": "node_modules\\typescript\\lib",
"[yaml]": {
"editor.autoIndent": "advanced"
},
}
9 changes: 6 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"tasks": [
{
"type": "typescript",
"tsconfig": "./tsconfig.build.json",
"tsconfig": "extension/tsconfig.json",
"problemMatcher": [
"$tsc"
]
],
},
{
"type": "npm",
Expand All @@ -50,6 +50,7 @@
"kind": "build",
"isDefault": true
},
"path": "extension"
},
{
"type": "npm",
Expand All @@ -59,13 +60,15 @@
"isBackground": true,
"presentation": {
"reveal": "never"
}
},
"path": "extension"
},
{
"type": "npm",
"script": "bundle-dev",
"group": "build",
"problemMatcher": "$esbuild",
"path": "extension"
}
]
}
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV GOBIN /gobin

# Install other Go tools tests depend on
RUN mkdir -p /scratch/installtools
ADD tools/installtools/main.go /scratch/installtools/main.go
ADD extension/tools/installtools/main.go /scratch/installtools/main.go
RUN go run /scratch/installtools/main.go

FROM node:latest
Expand Down
Loading

0 comments on commit 690cf2e

Please sign in to comment.