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

cmd/govim: place signs for existing diagnostics in new buffers #590

Merged
merged 1 commit into from
Dec 1, 2019

Conversation

leitzler
Copy link
Member

If gopls report diagnostics for files that aren't opened in vim
they won't get any signs placed when they are opened.

A typical use case is when staticcheck report diagnostics for
a file that isn't opened, and the user uses quickfix to jump
directly to the issue (effectively opening a new buffer).

This change updates the internal diagnostics cache when a buffer
is read or closed so existing diagnostics will have signs placed.

@leitzler leitzler force-pushed the cmd_govim_signs_for_known_diags branch from 0a2c522 to 7f6067a Compare November 22, 2019 22:39
@leitzler
Copy link
Member Author

I moved the new test to a separate file, since it seems like changing the entire buffer often trigger #591 (previously it was a part of signs.txt but with a separate main.go).

@leitzler leitzler requested a review from myitcv November 23, 2019 08:56
Copy link
Member

@myitcv myitcv left a comment

Choose a reason for hiding this comment

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

LGTM with a couple of thoughts

cmd/govim/buffer_events.go Outdated Show resolved Hide resolved
cmd/govim/buffer_events.go Show resolved Hide resolved
cmd/govim/buffer_events.go Show resolved Hide resolved
cmd/govim/diagnostics.go Outdated Show resolved Hide resolved
cmd/govim/main.go Show resolved Hide resolved
If gopls report diagnostics for files that aren't opened in vim
they won't get any signs placed when they are opened.

A typical use case is when staticcheck report diagnostics for
a file that isn't opened, and the user uses quickfix to jump
directly to the issue (effectively opening a new buffer).

This change updates the internal diagnostics cache when a buffer
is read or closed so existing diagnostics will have signs placed.
@leitzler leitzler force-pushed the cmd_govim_signs_for_known_diags branch from 7f6067a to b416a3a Compare November 29, 2019 11:57
@leitzler leitzler merged commit 4757564 into master Dec 1, 2019
@leitzler leitzler deleted the cmd_govim_signs_for_known_diags branch December 1, 2019 11: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.

None yet

2 participants