fix: wrap vim.fn.complete into pcall when adding to dot repeat#2018
Closed
geril07 wants to merge 1 commit intosaghen:mainfrom
Closed
fix: wrap vim.fn.complete into pcall when adding to dot repeat#2018geril07 wants to merge 1 commit intosaghen:mainfrom
geril07 wants to merge 1 commit intosaghen:mainfrom
Conversation
Owner
|
In #2022, I decided to check if the mode was not |
Owner
|
Closing in favor of #2022. Thanks again for all your help on that one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
There’s a window(
resolve_timeout_ms) where you can do anything (like switch to Normal mode) between selecting a completion item and LSP resolving it. The problem is thatvim.fn.completethrows an error outside of Insert mode. So if you typeTab -> Escyou can hit this problem if an LSP will take some time to resolve. Happens to me every day or two.Solution: Wrap it into
pcalland notify a user that dot repeat logic is failed. But I am not sure about the message format, maybe you can find a better one.Before
before.mp4
After
after.mp4
But it opens up another problem. As you can see in the "after" demo, there's an incorrect t character left at the end of the completion. This happens because switching to Normal mode decreases the cursor's column position by 1, so the last character isn’t cleared.
Still, I think it’s better to deal with an extra character than with the original error.
I described more about this there #1491.