src/goLanguageServer: fix config adjustment
The config object the middleware receives can be a non-extensible object.
Create a new config object and use it before attempting to mutate the property.
Updates golang/vscode-go#886
Change-Id: I5855ead23c1cfc20f879583169397dd1515e1e44
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/267678
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
diff --git a/src/goLanguageServer.ts b/src/goLanguageServer.ts
index 0ca71c7..9d0dcf7 100644
--- a/src/goLanguageServer.ts
+++ b/src/goLanguageServer.ts
@@ -443,10 +443,11 @@
if (!sv || semver.lt(sv, 'v0.5.2')) {
return config;
}
+ const newConfig = Object.assign({}, config);
if (!config['allExperiments']) {
- config['allExperiments'] = true;
+ newConfig['allExperiments'] = true;
}
- return config;
+ return newConfig;
}
// createTestCodeLens adds the go.test.cursor and go.debug.cursor code lens