-
Notifications
You must be signed in to change notification settings - Fork 411
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
Autocompletion overwrites following characters #425
Conversation
@snjeza care to explain the rationale of this change? |
The validationTimer job is a LONG job and starts after 100ms even when we call job.schedule(0). |
The PR doesn't work and breaks the delayed validation. I have updated it. You will be able to reproduce the issue if you use a larger project and edit a big class. I have used the che-plugin-openshift-client project and the OpenShiftConnector class (the che project is built from the command line).
Also, sometimes code actions throw an exception (usually 'End of File'). The PR solves the issue by waiting for the completion to finish. The PR also sets a timeout of 1 second for the completion. You can also test the issue by setting the following property:
In this case, VS Code sends document/completion after 500ms which is enough that Java LS completes several didChange commands so that you won't be able to reproduce the issue. |
proposals.addAll(collector.getCompletionItems()); | ||
IProgressMonitor subMonitor = new NullProgressMonitor() { | ||
private final static int TIMEOUT = 1000; | ||
private long endTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we call it timeLimit?
@@ -77,8 +86,27 @@ | |||
if (offset >-1 && !monitor.isCanceled()) { | |||
IBuffer buffer = unit.getBuffer(); | |||
if (buffer != null && buffer.getLength() >= offset) { | |||
unit.codeComplete(offset, collector, monitor); | |||
proposals.addAll(collector.getCompletionItems()); | |||
IProgressMonitor subMonitor = new NullProgressMonitor() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't you wrap the outer monitor so that if the user cancels it, the submonitor is cancelled too?
Signed-off-by: Snjezana Peco <[email protected]>
@fbricon I have updated the PR. |
This makes code completion super snappy again, nice work @snjeza! |
Does the 1s timeout affect My client (for better or, more likely worse) attempts to resolve every completion item as we have no way to resolve based on what the user is looking at (details not interesting). The test case is File (https://github.com/puremourning/ycmd-1/blob/java-language-server/ycmd/tests/java/testdata/simple_eclipse_project/src/com/youcompleteme/Test.java), line 16 requesting completion after the here's a snippet log (full log in gist here https://gist.github.com/anonymous/2329af7bff6bc5a6cfc51dfbddcd27b5) : This commit:
Commit prior to this one:
As you can see, in the previous commit, |
Fixes redhat-developer/vscode-java#352 (comment)
Signed-off-by: Snjezana Peco [email protected]