Skip to content

Handle files that have not completed lowering in LSP#4439

Merged
doriable merged 2 commits intomainfrom
better-handle-compiler-failures
Apr 10, 2026
Merged

Handle files that have not completed lowering in LSP#4439
doriable merged 2 commits intomainfrom
better-handle-compiler-failures

Conversation

@doriable
Copy link
Copy Markdown
Member

@doriable doriable commented Apr 9, 2026

This implements more graceful behaviour in the LSP for when
a file is unable to go through the full lowering process, and therefore
cannot/does not have fully resolved symbols for LSP functionality, and
attempts to return the most helpful possible diagnostic to the user to
communicate this.

Fixes #4434

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedApr 10, 2026, 12:42 AM

@doriable doriable requested review from stefanvanburen and removed request for stefanvanburen April 9, 2026 19:38
Copy link
Copy Markdown
Member

@stefanvanburen stefanvanburen left a comment

Choose a reason for hiding this comment

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

👍, just a quick drive-by

Comment on lines +365 to +366
Message: fmt.Sprintf(`the symbols for this file have not been fully resolved due to an invalid version of descriptor.proto located at: %q.
this is likely due to a vendored descriptor.proto.`,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: I think the diagnostics tend to be sentence-cased?

Suggested change
Message: fmt.Sprintf(`the symbols for this file have not been fully resolved due to an invalid version of descriptor.proto located at: %q.
this is likely due to a vendored descriptor.proto.`,
Message: fmt.Sprintf(`The symbols for this file have not been fully resolved due to an invalid version of descriptor.proto located at: %q.
This is likely due to a vendored descriptor.proto.`,

Comment on lines +46 to +51
message := reportDiagnostic.Message()
if reportDiagnostic.Level() == report.ICE {
// Include notes for ICE
notes := append([]string{message}, reportDiagnostic.Notes()...)
message = strings.Join(notes, " ")
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

neat; separately, feels like we ought to integrate .Notes() / .Help() / .Debug() somehow when they're available, and not just conditionally?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah -- I think the follow-up once the compiler is fully ported, and the Help/Debug in particular are reaching much stabler state than when the LSP was first launched, we should turn them into code actions. So there's definitely some follow-up improvements to do here.

@doriable doriable requested a review from stefanvanburen April 10, 2026 00:42
@doriable doriable marked this pull request as ready for review April 10, 2026 00:42
@doriable doriable merged commit 49bbbe0 into main Apr 10, 2026
11 checks passed
@doriable doriable deleted the better-handle-compiler-failures branch April 10, 2026 14:13
stefanvanburen added a commit that referenced this pull request Apr 10, 2026
Quick follow-up to #4439. In that PR, we mentioned that these [fields
could become code actions][1], which is probably true with some
refactoring / exporting of more of the underlying structure so we don't
have just `string`s without more structured data. For now, it seems
valuable to just expose these as additional information added to the
hover states. See the added test-cases for how these look.

[1]: #4439 (comment)
stefanvanburen added a commit that referenced this pull request Apr 10, 2026
Quick follow-up to #4439. In that PR, we mentioned that these [fields
could become code actions][1], which is probably true with some
refactoring / exporting of more of the underlying structure so we don't
have just `string`s without more structured data. For now, it seems
valuable to just expose these as additional information added to the
hover states. See the added test-cases for how these look.

[1]: #4439 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buf LSP panics in DocumentSymbol via ir.Type.Deprecated on devel build

3 participants