Conversation
- attempting to open the next completion can cause problems if the completion itself is not implemented properly (infinite completion loops) - to mitigate this we can check if the last removed group of the template had "completionInvoke" set, so that for example constructor completions still works as expected follow up on apache#2519, apache#3290
728ca8a to
ab3fecb
Compare
|
everything looks good so far. I did some testing with editor templates but would have to do more to be confident that this does not cause regressions. |
|
The thing is that it take sometime (some ms) to add the () after I hit enter to see the ctor but this is a general problem I think. I just wanted to mentioned it here, because I think this is of this completion chaining stuff what you mentioned. I mean I really wanted the ctor and it still completes to new HashMap<>...~200ms new HashMap<>(). Why not just immediately? |
I don't think i can reproduce this issue. The text substitution happens as fast as i can press return twice in a row. Might be influenced by the complexity of the document/project, this PR doesn't do any heavy lifting, it only tweaks the conditions when followup/parametrized completions are triggered.
because the first completion is for the type (HashMap), the second for the constructor. There is more than one constructor, therefore another completion popup opens. If there would be just one constructor it would insert it right away. Thats also why #3805 loops forever since the completion itself sets the cursor to a location which resembles the initial conditions (and there is just one item in the completion list). edit: btw #4142 is working on removing a completion related bottleneck, but this isn't related to this PR here |
|
Add: This is my misunderstanding, sorry. |
|
@junichi11 this isn't java specific. |
|
@mbien I don't say about it. If we can implement your issue in the Java editor, we shouldn't change the editor. e.g. call the method like the following ( private static ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
private static void scheduleShowingCompletion() {
service.schedule(() -> {
Completion.get().showCompletion();
}, 750, TimeUnit.MILLISECONDS);
} |
|
What is the delay for and why is it that high? I mean, I see for what it is, but why is it intended to be that high to wait for it? |
again. This is not a java issue. A completion template (for any language) with a |
|
@mbien Ah, I see now. I thought you are working on a Java issue, sorry. |
|
@lkishalmi Is groovy using the same API for code completion (ide/editor.codetemplates)? We tested this PR for php and java and it looks promising. |
|
@mbien I'm sorry, but I do not know the Groovy implementation details. |
|
I don't feel really qualified to review this. However I verified, that the issue is gone and the behavior seems to be fixed. The changes look ok to me. |
|
if anyone knows someone who might want to review this, please add to PR. |
|
i would like to merge this one soon too so that it gets good testing in during NB 15 dev |
|
Agree. |

completion itself is not implemented properly (infinite completion
loops)
template had "completionInvoke" set, so that for example constructor
completions still work as expected
follow up on #2519, #3290
history:
#2519 fixed a separate issue, but caused also a regression. #3290 attempted to restore the functionality (<12.3) without reverting #2519 but this could cause the above mentioned issue in some situations.
example for a completion which never finishes: #3805
example for completion chaining (intended behavior):
lets see if all tests are green.