This repository was archived by the owner on Oct 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
enable godef-based textDocument/definition implementation #195
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…fc69a85ed86b96280c78c83a3a7258dea
…improves performance) This change adds a `-usebinarypkgcache=true` flag which uses `$GOPATH/pkg` binary `.a` files in order to improve the performance of `textDocument/definition` requests. In short, we no longer require typechecking to perform these requests which saves us several hundreds of MB of memory _and_, more importantly, a lot of CPU resources. Because this uses .a files from disk, this option will be disabled on sourcegraph.com where only the VFS is used. In the future, however, we can and should consider consolidating these two code paths where possible. Our existing test suite has proven very useful during development in ensuring this implementation is at least on par with our current one, so there is no concern of this being sub-par or broken in subtle ways as far as I see.
This change adds a `-maxparallelism` flag which defaults to 1/2 the NumCPU on the machine. It is used to control the language server's use of parallelism in editor environments where using all available resources to answer a query is not most ideal.
keegancsmith
approved these changes
Jun 22, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is great! I'd be very keen to make it the default way if we can work out a nice way for storing the .a
files on the server.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
$GOPATH/pkg
binary.a
files to resolve the definition location of symbols, meaning it does not have to typecheck the entire program in order to perform atextDocument/definition
request.godef
tool as a base, converting it into a usable Go package that we can import, and enabling this feature under a flag. In practice this uses almost no CPU in comparison to our old approach.workspace/symbol
.Note: This change on it's own still is not good enough to close either of those issues, as hover still uses a type-checking-based implementation and thus hovers still use far too much CPU resources. I am working currently on a new hover implementation that will also use godef / avoid type-checking.
Note: Both of these features will be disabled on Sourcegraph.com, as we cannot use
$GOPATH/pkg
there and wantworkspace/symbol
to use as much CPU as possible there. In the future, we can consolidate these two code paths further.