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

Autocompletion is not cancelled on space #187

Closed
fbricon opened this issue Apr 19, 2017 · 10 comments
Closed

Autocompletion is not cancelled on space #187

fbricon opened this issue Apr 19, 2017 · 10 comments
Assignees
Labels
Milestone

Comments

@fbricon
Copy link
Collaborator

fbricon commented Apr 19, 2017

If I have Collection c = ne| autocompletion will propose new among other things. If I continue typing without hitting tab or escape, then new Arr, despite the space, will continue proposing new and all other stuff containing these letters.
screen shot 2017-04-19 at 9 48 50 am

I think hitting space should cancel autocompletion. But I'm not sure if it's a vscode proper or vscode-java configuration. @jrieken?

@jrieken
Copy link

jrieken commented Apr 19, 2017

That is happens when proposals still match. VS Code doesn't have a static rule when to hide/show/retrigger completions but uses the information provided by completions. Those are the label (and filterText if present) and the range of the completion (which defaults to the current word). The existing text that is selected by the range is used to score against label (or filterText), in above sample new Arr against NewLineEvent - groovyjarjarantlr.debug.

ne| autocompletion will propose new among other things.

Is this just new or a full ctor-call, like new Collection? Or is 'among other things' other globals like NewLineEvent?

@fbricon
Copy link
Collaborator Author

fbricon commented Apr 19, 2017

I just keep on typing, no Ctrl+Space involved. So new is proposed, as well as other classes:
apr-19-2017 10-03-14

@fbricon
Copy link
Collaborator Author

fbricon commented Apr 19, 2017

Ok, so the fact the labels contain spaces is fucking us up

{
            "label": "NewInstanceInstantiator - org.springframework.objenesis.instantiator.basic",
            "kind": 7,
            "sortText": "zzzzzzzdhc",
            "data": {
                "decl_signature": "Lorg.springframework.objenesis.instantiator.basic.NewInstanceInstantiator;",
                "pid": "16",
                "rid": "29",
                "uri": "file:/Users/fbricon/Dev/projects/spring-boot-mongodb/src/main/java/guru/springframework/SpringBootMongodbApplication.java"
            }
        },
        {
            "label": "new",
            "kind": 14,
            "sortText": "zzzzzzzbej",
            "data": {
                "pid": "17",
                "rid": "29",
                "uri": "file:/Users/fbricon/Dev/projects/spring-boot-mongodb/src/main/java/guru/springframework/SpringBootMongodbApplication.java"
            }
        }

@jrieken
Copy link

jrieken commented Apr 19, 2017

Ok, so the fact the labels contain spaces is fucking us up

Yes, you could try putting that extra bit (org.springframework.objenesis.instantiator.basic et al) into detail

Works as I have to tried to describe above. What confuses me is that ArrayList is proposed towards the end of the gif. Are the completion lists you return marked as incomplete?

@fbricon
Copy link
Collaborator Author

fbricon commented Apr 19, 2017

Ok, I can try to put stuff into the detail field. Sounds better than my thinking about using some unicode trick to look like a space :-)

Seems we return "isIncomplete": false

@fbricon
Copy link
Collaborator Author

fbricon commented Apr 19, 2017

Ok so using detail seems to fix most of the problems when typing space. Changing all cases server-side to use detail is gonna be tedious, but doable. There would still be a minor problem with method completion though, because we display all overridden methods including parameters separated by space (We chose not to use SignatureHelp as we found it less productive), but I think that's manageable.

But the main problem with using detail is the proposal needs to be selected for the detail to be displayed. Currently, you can see all proposals with a Type - package pattern. We'd lose that package information.

screen shot 2017-04-19 at 11 03 15 am

@jrieken
Copy link

jrieken commented Apr 19, 2017

But the main problem with using detail is the proposal needs to be selected for the detail to be displayed. Currently, you can see all proposals with a Type - package pattern. We'd lose that package information.

Yeah, that's part of our design of being minimal. /cc @stevencl

@fbricon
Copy link
Collaborator Author

fbricon commented May 15, 2017

@jrieken so as an alternative, I tried using filterText:

/**
 * A string that should be used when filtering a set of
 * completion items. When `falsy` the label is used.
 */
filterText?: string;

So our completionItems now look like

{
  "label": "Map - java.util",
   "kind": 7,
   "sortText": "zzzzzzzbge",
   "filterText": "Map",
   "data": {
       "decl_signature": "Ljava.util.Map;",
       "pid": "62",
       "rid": "6",
       "uri": "file:/Users/fbricon/Dev/vertx-game-server/src/main/java/com/redhat/middleware/keynote/GameUtils.java"
     }
},

But vscode still seems to filter using the label
may-15-2017 13-24-42

So either I don't grok how filterText is supposed to work or vscode ignores filterText. The former is the most plausible.

@jrieken
Copy link

jrieken commented May 16, 2017

But vscode still seems to filter using the label

Yeah, we always try with the label first and use the filter text only when not matching the label. Mostly because when using the filter text we cannot render the blue highlights. But it could be considered a bug on our side

@fbricon
Copy link
Collaborator Author

fbricon commented May 23, 2017

Initial tests with filterText and latest insiders build look good. Will provide a proper PR on jdt.ls soon.

@fbricon fbricon self-assigned this May 23, 2017
@fbricon fbricon added the bug label May 23, 2017
@fbricon fbricon added this to the End May 2017 milestone May 23, 2017
fbricon added a commit to fbricon/eclipse.jdt.ls that referenced this issue May 23, 2017
Fixes redhat-developer/vscode-java#187

Signed-off-by: Fred Bricon <fbricon@gmail.com>
fbricon added a commit to fbricon/eclipse.jdt.ls that referenced this issue May 23, 2017
Fixes redhat-developer/vscode-java#187

Signed-off-by: Fred Bricon <fbricon@gmail.com>
fbricon added a commit to eclipse-jdtls/eclipse.jdt.ls that referenced this issue May 23, 2017
Fixes redhat-developer/vscode-java#187

Signed-off-by: Fred Bricon <fbricon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants