This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
test/gopls: initial test setup for gopls and hover tests #3157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This CL includes only HoverProvider tests, that use the same scenario
as the hover provider tests with godoc and gogetdoc in
integration/extension.test.ts.
Gopls test setup is complicated because gopls currently does not
work in a single-file mode nor support mono repos with multiple
modules. VS Code in test environment does not support dynamic
registration of workspace folders during testing. So, the
workspace folder needs to be specified before the extension
host launches (by vscode-test.runTests or launch.json extensionHost
type tasks).
As a workaround, I use an empty directory and start the extension
host with the empty directory for a testing. Then, let the test
populate the directory with necessary files. This is not ideal;
file copy is slow and the use of the single workspace directory
prevents parallelized testing.
Commiting an empty directory to use as a scratch space is not
ideal either, but no worse than what vscode dev in my opinion.
https://github.com/microsoft/vscode/blob/master/.vscode/launch.json
I also considered shelling out the extension host launch
after creating a temp directory and using it as a workspace directory.
That may work inside test/runTest.ts, but complicates debugging
when sarting the test using launch.json.
Also passes '--user-data-dir' flag to prevent the tests from
using my personal vscode settings and interfere tests.
Change-Id: I7b064441720da5c89833afab35e8273de808cfad