Skip to content

Fix unrequested codecompletion menu: When asking for auto-completion,…#6

Merged
spillz merged 1 commit into
spillz:masterfrom
yvesdm3000:master
Jun 4, 2018
Merged

Fix unrequested codecompletion menu: When asking for auto-completion,…#6
spillz merged 1 commit into
spillz:masterfrom
yvesdm3000:master

Conversation

@yvesdm3000

Copy link
Copy Markdown
Contributor

… a background task starts, and then the insertion-point changes by the user (probably he doesn't want to wait for the CC results), the codecompletion menu still apeared at a (possibly) undesired location. Should fix Issue#5
(Fix is similar on how Clang CC fixes the exact same issue)

… a background task starts, and then the insertion-point changes by the user (probably he doesn't want to wait for the CC results), the codecompletion menu still apeared at a (possibly) undesired location. Should fix Issue#5
@spillz

spillz commented Mar 22, 2017

Copy link
Copy Markdown
Owner

Doesn't this have the (albeit infrequently occurring) weakness that if you add/delete some code you could still be at the same place but get the wrong completion? My original plan was to add a unique ID to each request (just an integer that increases with each request) and ignore responses that aren't the latest request. It takes a little bit more fiddling to add the ID to the python request, but it's not a big deal.

@yvesdm3000

Copy link
Copy Markdown
Contributor Author

That is indeed a drawback, but the solution with the ID has been tried by me before in ClangCC. It is worse in the sense that if the user advances without performing a new CC request (like pressing enter and having the cursor on an empty line, or clicking somewere else), the completion-menu appears anyway and let that be the situations that are annoying to me. Also the calibration cursor point is at the start of the word, not the point where cc was requested, it solves some corner cases (but not all as you noted) and this way the user can type more letters of the word cc is calculating in the mean time.

@spillz

spillz commented Mar 23, 2017

Copy link
Copy Markdown
Owner

Sorry that was dumb of me. I actually have a simplified request counter in place anyway, which I think takes care of stale requests (but maybe has bugs?). So your change is a useful addition on top of that.

But in addition to cursor movement we should try to monitor for any change in editor state and block the cc popups, right?

@yvesdm3000

Copy link
Copy Markdown
Contributor Author

That is a possibility, but this can be very tricky. I kind of like the current behaviour that a CC-request is running in the background and that you can continue on typing without the need of a new CC-request (that is what that column-calculation is for). What would be possible though is an editor-event-handler do a check that if the cursor arrives before the CC-position for whatever reason, cancel out the outstanding CC-request.

@spillz spillz merged commit 28584f2 into spillz:master Jun 4, 2018
@spillz

spillz commented Jun 4, 2018

Copy link
Copy Markdown
Owner

Merged (finally!). Thanks.

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.

2 participants