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

Diagnostics fixes - hopefully only the non-controversial parts #4187

Merged
merged 3 commits into from
Oct 6, 2023

Conversation

bstaletic
Copy link
Collaborator

@bstaletic bstaletic commented Sep 19, 2023

PR Prelude

Thank you for working on YCM! :)

Please complete these steps and check these boxes (by putting an x inside
the brackets) before filing your PR:

  • I have read and understood YCM's CONTRIBUTING document.
  • I have read and understood YCM's CODE_OF_CONDUCT document.
  • I have included tests for the changes in my PR. If not, I have included a
    rationale for why I haven't.
  • I understand my PR may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Why this change is necessary and useful

This PR fixes two diagnostic bugs, makes one harder to solve and leaves one for later:

  1. Diagnostic echo on enter if echoing virtual-text when asked not to. - Fixed
  2. No diagnostic refresh if leaving insert mode after a semantic trigger. - Fixed
  3. Echo flicker on insert leave. - Harder to fix. Previously caused only by CursorMoved, now by InsertLeave too.
  4. Sign column bounce - still thinking about the best way to fix it.

I have tried fixing number 3, but all I could come up with were some heuristics which were always wrong in some case...

Are these changes still too controversial?

I will (try to) write the vim level tests when we agree about the way forward.


This change is Reviewable

@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Merging #4187 (456b469) into master (88ed5a7) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4187      +/-   ##
==========================================
- Coverage   89.00%   88.96%   -0.05%     
==========================================
  Files          34       34              
  Lines        4403     4404       +1     
==========================================
- Hits         3919     3918       -1     
- Misses        484      486       +2     

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

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

Thanks!

I'm going to try this out today at work.

Reviewable status: 0 of 2 LGTMs obtained

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

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

FWIW fixes seem fine and not that controvertial

Reviewable status: 0 of 2 LGTMs obtained

…sert_mode == 0

Needed settings:

let g:ycm_update_diagnostics_in_insert_mode = 0
let g:ycm_echo_current_diagnostic = 'virtual-text'

Previously, whenever we should NOT display diagnostic UI, but diag
message would not need clearing, we ended up echoing. Most noticable in
the following example

int main() {
	puts("")<CR>
}

Note that this first patch still leaves a diagnostic UI flicker on
InsertLeave.
In case the current filetype language server uses LSP async diagnostics,
we might not get a reparse on InsertLeave. This happens if the user
leaves insert mode after a semantic trigger.

We would still try sending a FileReadyToParse request, but the diags get
ignored, because:

a) The filetype is known to use async diags.
b) We do not insist on a synchronous diag update, like :YcmDiags.

The solution is to check if the current filetype uses async diagnostics
and, if so, let InsertLeave refresh diagnostic UI regardless of what the
state of FileReadyToParse request is.

Note that this solution makes the flicker on leaving insert mode harder
to fix. Not only does OnCursorMoved cause a refresh of stale
diagnostics, but so does OnInsertLeave.
@bstaletic
Copy link
Collaborator Author

Tests added. No idea what codecov is talking about.

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: 1 of 2 LGTMs obtained (waiting on @bstaletic)

@bstaletic bstaletic added the Ship It! Manual override to merge a PR by maintainer label Oct 6, 2023
@mergify
Copy link
Contributor

mergify bot commented Oct 6, 2023

Thanks for sending a PR!

@mergify mergify bot merged commit cc9a3ae into ycm-core:master Oct 6, 2023
10 of 13 checks passed
@bstaletic bstaletic deleted the diag-fixes-pt1 branch October 6, 2023 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ship It! Manual override to merge a PR by maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants