Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve LSP diagnostic info #3436

Merged
merged 2 commits into from
Nov 4, 2024
Merged

Conversation

stefanvanburen
Copy link
Member

This removes the extraneous information from the diagnostic report (filename, line, column), which is already included in the range.

It also adds a hard-coded buf as the source of the diagnostic.

Before:

image

After:

image

This removes the extraneous information from the diagnostic report
(filename, line, column), which is already included in the range.

It also adds a hard-coded `buf` as the source of the diagnostic.
Copy link
Contributor

github-actions bot commented Oct 30, 2024

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedOct 31, 2024, 4:43 PM

Comment on lines 80 to 81
Message: err.Unwrap().Error(),
Source: "buf",
Copy link
Member

Choose a reason for hiding this comment

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

I think this change is reasonable, but I believe one of the reasons we print out the position information is because this is also printed into the console of VSCode, for example, so we want more information. But agree that in-line, this is clearer.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, I figured different clients might have different displays. Definitely open to figuring out what makes sense for most clients.

I will note though that adding the position information is inconsistent with some of our other diagnostics (e.g. our buf lint diagnostics):

image

Copy link
Member Author

Choose a reason for hiding this comment

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

(It's possible that we should consistently use buf-lsp as our source, FWIW?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Go lsp doesn't include line diagnostics, so this makes sense to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

given @doriable's 👍 to consistently using buf-lsp as a source, did that in d2c6441.

I've seen different LSPs do different things, e.g. I think gopls uses the individual analyzer name as the source, but I think starting consistently with buf-lsp is better for now.

@stefanvanburen stefanvanburen merged commit b760d59 into main Nov 4, 2024
10 checks passed
@stefanvanburen stefanvanburen deleted the svanburen/improve-lsp-report branch November 4, 2024 14:00
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.

3 participants