Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Restart language server automatically when its configuration changes #3211

Closed
wants to merge 51 commits into from
Closed

Conversation

stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Apr 29, 2020

This change replaces the messages that tell the user to reload with automatic calls to the restart function. This way, config changes are automatically reflected - I tested it out locally and it worked pretty nicely. Most of the code to do this was already there, it was just a matter of reordering it correctly and making sure to deregister/re-register the default providers. I also added the mtime check for the language server binary as part of the config.

The only other thing that might be still missing is automatic restarts when the language server binary changes on disk, but that might be too much - probably wouldn't be intuitive for the user.

After this is merged, it will be really simple to implement #3128.

Sorry about the huge PR! It's a lot of code shuffling, and there's one function that I moved back to its original place after #3186 - sorry about that!

/cc @hyangah

hyangah and others added 30 commits March 4, 2020 10:55
Change-Id: I536057b891b495e5c766a4230fabdc8519d08981
Change-Id: Ic1fe3eb79f85d6a0eafea20dc7dc6e5d283d7ca4
This changes the extension publisher id and name for nightly.
And set the preview field.
Go Nightly is a preview of Go extension.

Also, disable telemetry by setting aiKey in telemetry.ts to be empty.

NIGHTLY ONLY

Change-Id: I89aee39334102e16db402019a087fcb6f5021a57
Also add isForNightly that is true if the extension is for nightly

The extension name is one of the best way to check the extension's mode,
but I couldn't find a way to dynamically determine the
current extensionId through vscode api. For now I use the already existing
constant that happens to be in the telemetry.ts.
The extensionId is useful for purposes other than telemetry, so
we'd better consider refactoring in the future.

NIGHTLY ONLY

Change-Id: I00377edbca233d1951052d200c730001493dc3cd
NIGHTLY ONLY

Change-Id: I9d20b35e4ccb1972b26f50b6d990bf1b95c8a405
Tested with the following commands

$ gcloud auth login
$ gcloud config set project vscode-go-insiders
$ gcloud builds submit --config build/cloudbuild.container.yaml
$ gcloud builds submit --config build/cloudbuild.yaml

NIGHTLY ONLY

Change-Id: I55f9cb181f8510caab7c7a8ff43d1e40540d7734
NIGHTLY ONLY

Change-Id: Iad0001757f578716ea62c44feee4da7ad4cfc77f
Ideally I want the CI to run from Gerrit because that will be our primary change review system,
but the internal system is not ready yet.
This is a temporary solution that uses Github Action. The CI workflow kicks in for every PR and every commit on the master.

Change-Id: I97c9d20f4649c4cafd7a984c02fa84d0bc70f554
GitHub-Last-Rev: 948b555
GitHub-Pull-Request: golang/vscode-go#4
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/222921
Reviewed-by: Rebecca Stambler <[email protected]>
Fixes the error in https://github.com/golang/vscode-go/actions/runs/53803644

And triggers the workflow for all push/prs.

Change-Id: I1aa506b0863485a640b47c5da1993ace739c4ce8
GitHub-Last-Rev: dac3185
GitHub-Pull-Request: golang/vscode-go#7
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/222924
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
Remove the code that handled this in the language server installation, and be careful to only install the tool specified by the user. Also, remove some unused import lines in the goLanguageServer.ts file.

Fixes #3028.

Change-Id: I813c39f7d4997b63f7a87c1551de23df2808259c
GitHub-Last-Rev: 9aa7363
GitHub-Pull-Request: golang/vscode-go#2
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/222417
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
If the env var GOPATH is not set when the test runs,
now it runs `go env GOPATH` to retrieve the default value
the underlying go commands will use. I wished I could make
this command run asynchronously, but I am not familiar with
the test framework and failed to make it working with
async functions. So, like many other file operations used in
the test setup phase, I am using execFileSync.

Update  golang/vscode-go#6

Change-Id: Id075827ab8ebd955f7a86460aaa7ea4e0e7cd183
GitHub-Last-Rev: 6222158
GitHub-Pull-Request: golang/vscode-go#8
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/223177
Reviewed-by: Andrew Bonventre <[email protected]>
Daily release workflow is triggered everyday between Mon-Thu, 15:00 UTC (11am EDT).
This prepares the version string through local modification on package.json
and runs the tests again before publishing. The newly released version has the
version string computed based on the last git commit's commit timestamp.
  <Year>.<Month>.<Day>-<Short Commit Hash>

That means, if there is no commit since the last release, the publishing step
will fail (because the MS VS Code extension market will detect the identical version).

Update golang/vscode-go#5

Change-Id: Ief59f5ed4e89eea66df3607f20263c3f6b75e716
GitHub-Last-Rev: b888148
GitHub-Pull-Request: golang/vscode-go#10
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/223677
Reviewed-by: Tyler Bui-Palsulich <[email protected]>
Marketplace does not allow prerelease annotation.
That caused the release error like
https://github.com/golang/vscode-go/runs/517074211?check_suite_focus=true

Use the four digit semver instead. Note the current `vsce package`
command allows prerelease annotation but does not allow four digit
semver format currently.

And record the commit hash to the CHANGELOG.md
since we cannot rely on the version string to encode the info.

Update golang/vscode-go#5

Change-Id: Id45fc822bb0d5b6b6750e28bf71bbb49f3eb97be
GitHub-Last-Rev: cf71291
GitHub-Pull-Request: golang/vscode-go#12
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/223961
Reviewed-by: Rebecca Stambler <[email protected]>
Change-Id: I9967b4024c34db71b8ea7d753da4790a4bec9fa7
GitHub-Last-Rev: 8678cf2
GitHub-Pull-Request: golang/vscode-go#15
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/224139
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
semver package is unhappy about X.Y.Z.W format of version string
and leave the extension in invalid state. Now make semver happy.

Also, use npm install to ensure all test dependencies are pulled in.

Change-Id: I98fd51b475fce20ef069b50b86a2eb9eba530032
GitHub-Last-Rev: 9bf48fc
GitHub-Pull-Request: golang/vscode-go#16
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/224099
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
 Merge 'microsoft/vscode-go/master' into 'golang/vscode-go/master'

    Sync @ 7da5077

    * master:
      Address mismatch on path separators in debug config (#2010) (#3108)
      Include the link to release note/package overview in the update prompt, and update gopls default version (#3041)
      bug_report.md: Fix "architecture" typo. (#3095)
      telemetry.ts: send telemetry only if aiKey is not an empty  string(#3091)

Change-Id: I727ef0ed3b8d1ad926e26831534c153b06070e64
GitHub-Last-Rev: d11e342
GitHub-Pull-Request: golang/vscode-go#11
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/224239
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
This command prints the list of configured tools and paths to the tools.
I hope this is useful when debugging the cases where multiple versions
of a tool exist in different directories.

Change-Id: I925422e262978300cbccc97b53d547e4b2f4b146
GitHub-Last-Rev: 4184fd3
GitHub-Pull-Request: golang/vscode-go#14
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/224098
Reviewed-by: Rebecca Stambler <[email protected]>
Merge branch 'master' of https://github.com/microsoft/vscode-go@d53b1b3

* 'master' of https://github.com/microsoft/vscode-go:
  goLanguageServer: set completion follow up command from middleware (#3084)
  Add stacktrace dump and better error messages on EXC_BAD_ACCESS panics (#2904)
  Address mismatch on path separators in debug config (#2010) (#3108)

Created by

`git pull --no-ff --log upstream master`

Change-Id: Id38768f3ec1bd01fa81325978f51f314fc1c08cb
GitHub-Last-Rev: 3a8de3f
GitHub-Pull-Request: golang/vscode-go#17
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/224240
Reviewed-by: Rebecca Stambler <[email protected]>
This reverts commit 25c7bf5.

Reason for revert: Not properly importing external commits (all commits were squashed and history was lost)

Change-Id: I4783c9b7ac25d5919ed56b4e923c968f9acf4725
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/224941
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
This reverts commit 19896f5.

Reason for revert: external commits were not properly imported. All commits were squashed into one and history was lost.

Change-Id: Ie8f1ca0cb53bd9dfaa8abf078ce261c92b79b845
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/224942
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
Modified src/goLanguageServer.ts to include missing import
of ProvideCompletionItemsSignature, which was removed by a locally
commited cl.

Change-Id: If6b10d60573095a40e652068f49bc378188b5e80
Change-Id: Iae9ee80b9fbbb64cc86b432487613334cf1fb72b
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/225097
Reviewed-by: Rebecca Stambler <[email protected]>
Change-Id: Ia05ff126a38fde31743c1ad72091b9e5b9e334e0
Change-Id: I834c9ec6b943eeed761c5fd4bbcca78c93d1c892
Also remove hardcoded reviewer emails

Change-Id: I0d6b9e7778b1801b3c092ecaae0e8685751a826b
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/225437
Reviewed-by: Rebecca Stambler <[email protected]>
Fixes golang/vscode-go#5

Change-Id: I56c6f6515ba6454adf6bf8f96e0a62cdacd1f13f
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/225438
Reviewed-by: Rebecca Stambler <[email protected]>
Change-Id: Ic43348753d9e53a26e9d8e45ad9f69ee16522a14
Change-Id: I71e6172c25326b7b03fd834fc79b50f95a6d133a
resolved conflicts caused by 8f5548a and b83ad81
that were committed to golang/vscode-go first, but had to be
changed to address comments during the upstream PR review.

Change-Id: I767e726e63c1dcff950745c753b1050010d35cbf
CHANGELOG for nightly release will be built in all.bash's prepare_nightly.
This helps reducing the merge conflicts.

NIGHTLY ONLY

Change-Id: I212661ef1b3376174a0e0079cac8b44f099869a7
GitHub-Last-Rev: 795acc3
GitHub-Pull-Request: golang/vscode-go#18
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/226978
Reviewed-by: Rebecca Stambler <[email protected]>
hyangah and others added 13 commits April 6, 2020 13:07
Change-Id: If3e81f47d6ff701bb35347bcedd7059147fe903a
That allows us to plumb the version picked from goLanguageServer's
latestGopls and request the installation of the specific version.
If the version is not specified in ToolAtVersion, it implies
the latest version of the tool.

Tested manually while gopls v0.3.0-preN became available.

Also, print the version in the installation result output.

Change-Id: Ic089bf15a0586c419440a85318d2c7976d1af62a
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/227480
Reviewed-by: Rebecca Stambler <[email protected]>
Change-Id: I95b3e73f2cfccf9d27dcb56a8a9ede289d418482
Change-Id: I1dcc362b1056d72c67cb7f15b7db888025a6384d
Change-Id: Iacab39e905324bb7f69e3c361857e764f8eae784
Change-Id: I77c0f413255e45419f4eb8ad988e818031ab52c7
GitHub-Last-Rev: ba87439
GitHub-Pull-Request: golang/vscode-go#21
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/228617
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
Change-Id: Ib310648164ca538b79e54be4d74f70b44975364c
Removed isForNightly from util.ts, and set the acceptGoplsPrerelease
var in goLanguageServer.ts directly. The variable was newly
added by microsoft/vscode@28e2d9.

Change-Id: Ic4bfe925cd3285632cefae7365d2835388bb081c
Change-Id: I129d6f62e0c89e1c489dfcd2a658b15dde362da0
Change-Id: I85b9ae1d9679d6a86065b162fe82e72bef91e392
Change-Id: I818414713f9e6f1561ddaef5d741c7c3ef2592c9
The lint rule was changed since PR #3157
so the newly added code broke the lint test.

Change-Id: Ic58dfa62e19cb61600b45fe10b43811eb00bc28d
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/230297
Reviewed-by: Rebecca Stambler <[email protected]>
Change-Id: I8c938531ba99d76cd90efa5c72ba8f4ef58d6b5c
@stamblerre stamblerre changed the title Restart language server automatically when configuration changes Restart language server automatically when its configuration changes Apr 29, 2020
Change-Id: I45754d89cb16fb2c9cd509c837c91dde38a6db23
src/goLanguageServer.ts Outdated Show resolved Hide resolved
src/goLanguageServer.ts Outdated Show resolved Hide resolved
src/goLanguageServer.ts Show resolved Hide resolved
src/goLanguageServer.ts Show resolved Hide resolved
src/goLanguageServer.ts Outdated Show resolved Hide resolved
src/goModules.ts Show resolved Hide resolved
Change-Id: I470e93a8cd2803b998a841fec099cdd66a018bd9
Change-Id: I6e8cf45b237f24cdf3c7847a6cc6ca7a321ee2a3
Copy link
Contributor

@hyangah hyangah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please check the build status? thanks!

src/goLanguageServer.ts Outdated Show resolved Hide resolved
Change-Id: I2c497e1b0ce02d6b443e3ff9f853ddc64a348a87
@stamblerre
Copy link
Contributor Author

Fixed! Sorry about that.

src/goLanguageServer.ts Outdated Show resolved Hide resolved
stamblerre and others added 3 commits May 5, 2020 17:28
Change-Id: I806c6eb56507c969c9d890f46c62747f8f29c988
Change-Id: I1272575625a2988bfd6ba4b28caf1028171147ac
This is available by the vscode lsp client library.
We needed to set the client id - the language server client
library to look up <client_id>.trace.server. Chose 'go' as
the client id.

Acceptable values (off, messages, verbose) are from
https://github.com/microsoft/vscode-languageserver-node/blob/b1f6a443efad3d61cf83344589099dab5318ca66/jsonrpc/src/main.ts#L207

Added this setting to package.json to allow the rich setting UI to
display it properly.

Note: this tracing is done by the lsp client, so it may be
different from the server-side logging gopls provides with
-rpc.trace options.

Change-Id: I3e33a16c953c78627e779383bba56d53ae51e8e0
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/232458
Reviewed-by: Rebecca Stambler <[email protected]>
Change-Id: Ic5f000624c89541b1ee50a47108a860bbb2d299e
@stamblerre
Copy link
Contributor Author

This has been merged through the nightly, so I'll abandon this here. There's no reason that this needs to be rushed into the next release.

@stamblerre stamblerre closed this May 6, 2020
@stamblerre stamblerre deleted the restart branch May 8, 2020 05:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants