Skip to content

Add LSP diagnostic when compilation fails#4318

Merged
stefanvanburen merged 2 commits intomainfrom
svanburen/handle-diagnostic-error
Feb 4, 2026
Merged

Add LSP diagnostic when compilation fails#4318
stefanvanburen merged 2 commits intomainfrom
svanburen/handle-diagnostic-error

Conversation

@stefanvanburen
Copy link
Member

Noticed that we weren't generating diagnostics for an import of a non-existent file, which made it confusing when the file looked fine otherwise.

Also, fixes the diagnostic to use proper .Start() and .End() for the diagnostic range, instead of a zero-width range consisting of only the start. (I might be missing something here, but worked for me; this was seemingly added way back in bufbuild/protocompile#205.)

Noticed that we weren't generating diagnostics for an import of
a non-existent file, which made it confusing when the file looked fine
otherwise.

Also, fixes the diagnostic to use proper .Start() and .End() for the
diagnostic range, instead of a zero-width range consisting of only the
start. (I might be missing something here, but worked for me; this was
seemingly added way back in bufbuild/protocompile#205.)
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 4, 2026, 8:57 PM

@stefanvanburen
Copy link
Member Author

Looks like:

image

This might be misusing the reporter APIs, but just so we aren't missing
a diagnostic, assume we can have one coming back in the error _and_ some
from the reporter.
@stefanvanburen stefanvanburen merged commit fd5e91b into main Feb 4, 2026
10 checks passed
@stefanvanburen stefanvanburen deleted the svanburen/handle-diagnostic-error branch February 4, 2026 21:02
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.

2 participants