This repository was archived by the owner on Jul 15, 2023. It is now read-only.
File tree 3 files changed +14
-3
lines changed
3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ export function installTools(missing: string[]) {
81
81
} ) ;
82
82
}
83
83
84
- export function setupGoPathAndOfferToInstallTools ( ) {
84
+ export function updateGoPathGoRootFromConfig ( ) {
85
85
let goroot = vscode . workspace . getConfiguration ( 'go' ) [ 'goroot' ] ;
86
86
if ( goroot ) {
87
87
process . env [ 'GOROOT' ] = goroot ;
@@ -90,7 +90,12 @@ export function setupGoPathAndOfferToInstallTools() {
90
90
let gopath = vscode . workspace . getConfiguration ( 'go' ) [ 'gopath' ] ;
91
91
if ( gopath ) {
92
92
process . env [ 'GOPATH' ] = gopath . replace ( / \$ { workspaceRoot} / g, vscode . workspace . rootPath ) ;
93
+ hideGoStatus ( ) ;
93
94
}
95
+ }
96
+
97
+ export function setupGoPathAndOfferToInstallTools ( ) {
98
+ updateGoPathGoRootFromConfig ( ) ;
94
99
95
100
if ( ! process . env [ 'GOPATH' ] ) {
96
101
let info = 'GOPATH is not set as an environment variable or via `go.gopath` setting in Code' ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import { GoSignatureHelpProvider } from './goSignature';
20
20
import { GoWorkspaceSymbolProvider } from './goSymbol' ;
21
21
import { GoCodeActionProvider } from './goCodeAction' ;
22
22
import { check , ICheckResult } from './goCheck' ;
23
- import { setupGoPathAndOfferToInstallTools } from './goInstallTools' ;
23
+ import { updateGoPathGoRootFromConfig , setupGoPathAndOfferToInstallTools } from './goInstallTools' ;
24
24
import { GO_MODE } from './goMode' ;
25
25
import { showHideStatus } from './goStatus' ;
26
26
import { coverageCurrentPackage , getCodeCoverage , removeCodeCoverage } from './goCover' ;
@@ -84,6 +84,10 @@ export function activate(ctx: vscode.ExtensionContext): void {
84
84
installAllTools ( ) ;
85
85
} ) ) ;
86
86
87
+ ctx . subscriptions . push ( vscode . workspace . onDidChangeConfiguration ( ( ) => {
88
+ updateGoPathGoRootFromConfig ( ) ;
89
+ } ) ) ;
90
+
87
91
vscode . languages . setLanguageConfiguration ( GO_MODE . language , {
88
92
indentationRules : {
89
93
// ^(.*\*/)?\s*\ }.*$
Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ export function showHideStatus() {
28
28
}
29
29
30
30
export function hideGoStatus ( ) {
31
- statusBarEntry . dispose ( ) ;
31
+ if ( statusBarEntry ) {
32
+ statusBarEntry . dispose ( ) ;
33
+ }
32
34
}
33
35
34
36
export function showGoStatus ( message : string , command : string , tooltip ?: string ) {
You can’t perform that action at this time.
0 commit comments