Repository navigation
Conversation
symbolInFile assumes every file in the workspace has a non-nil IR, but files whose IR could not be built have a nil *ir.File. The organize imports code action searches all workspace files for an unresolved symbol, so a single unbuildable file crashed the language server on every code action request, and on every restart. Skip files without IR when searching for symbols.
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Organize imports searches every file in the workspace for an unresolved
symbol. A file whose IR failed to build has a nil
*ir.File, andsymbolInFiledereferenced it:symbolInFileis the only place that assumesfile.iris non-nil;(*file).RefreshIRand(*file).IndexSymbolsalready guard against it.Because the organize imports code action is requested when a file is
opened, a workspace with one unbuildable file crashes the server on every
restart, until the client gives up: "The Buf Language Server server
crashed 5 times in the last 3 minutes".
Skip files without IR when searching for symbols: they have no symbols to
report. Files that do have IR are searched as before.
The added test calls
symbolInFilewith a file that has no IR. It panicson the current code and passes with the guard.