Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@myitcv
Copy link
Member

@myitcv myitcv commented Mar 5, 2020

No description provided.

@myitcv myitcv force-pushed the cmd_govim_fix_diagnostic_handling branch from 01572d7 to 42f36aa Compare March 7, 2020 20:39
@myitcv myitcv requested a review from leitzler March 7, 2020 20:41
leitzler added a commit that referenced this pull request Mar 9, 2020
During review of #811 I noticed that we are lacking tests of sign
placment.

This change adds a test that ensures that signs are placed when loading
a unloaded buffer, after being temporary removed by a masking error.
In 8826ef5 (since backed out) we uncovered a bug in our handling of
changed diagnostics from gopls. Currently we keep track of whether
quickfix, sign and highlights have changed since we last tried to update
any of the aforementioned categories. However, this is imprecise: we
should instead keep track of the diagnostics that were last used to
update Vim. Therefore we now track the diagnostics used to, for example,
update diagnostics via govim.lastDiagnosticsQuickfix, of type
*[]types.Diagnostic.

The refactor also necessitated a change in how we determine whether two
quickfix entries are equal or not. We now compare quickfix entries
modulo the buffer number (which can, and does, change in a Vim session).

We also fix a bug that was also hidden by the current implementation
whereby signs weren't being re-placed when a buffer is reloaded.

We also add some context to each fire of an autocommand, such that the
call from Vim -> govim that is made in response to an event includes the
autocommand event definition so that it's easier to spot what event is
firing. e.g:

   recvJSONMsg: ["function","autocommand:3","BufNewFile,BufRead *"...

We also fix up GOVIMStringFn to work correctly at the end of files and
update the test accordingly to add coverage of this.

We also add a number of tests to verify that govim behaves when saving
unnamed buffers to go/non-go files, opening go/non-go files and
switching to go/non-go files, skipping the one case that does not work
in light of us having raised #810.
@myitcv myitcv force-pushed the cmd_govim_fix_diagnostic_handling branch from 42f36aa to 1f92580 Compare March 9, 2020 14:22
Copy link
Member

@leitzler leitzler left a comment

Choose a reason for hiding this comment

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

A bit large PR, but LGTM!

@myitcv
Copy link
Member Author

myitcv commented Mar 9, 2020

A bit large PR, but LGTM!

Yes sorry about that. Like the revert of the buffer life-cycle changes, I was trying to keep this PR as close to 8826ef5 minus the buffer life-cycle changes as possible.

@myitcv myitcv merged commit 097679e into master Mar 9, 2020
@myitcv myitcv deleted the cmd_govim_fix_diagnostic_handling branch March 9, 2020 20:57
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