Skip to content

Intellisense should be hidden when inside new function brackets #1254

Closed

Description

@nklayman

when you write a new function, intellisense suggestions pop up as soon as you finish myFunc(). They stay up when you add curly braces myFunc() {}. This means when you press enter to create a multiline function, the intellisense snippet item is inserted instead.
screenshot from 2018-10-15 21-07-28
Pressing enter gives:
screenshot from 2018-10-15 21-11-02
intellisense should be hidden here, so that you can add a line w/out triggering a snippet.

Activity

  1. nklayman commented on Oct 16, 2018

    @nklayman
    Author

    Looks like this shouldn't happen because of this line. However, as you can see in the image, the suggestions still show.

  2. nklayman commented on Oct 16, 2018

    @nklayman
    Author

    It also only shows snippets, maybe because that check isn't included in the snippet provider.

  3. DanTup commented on Oct 16, 2018

    @DanTup
    Member

    Thanks for the report! I can repro something, but I'm not sure if it's exactly what you're seeing. The issue I see is when pressing <space> after the parens:

    Eg.:

    myFunc()/* press space here, ready to type { */

    Though I see much more than just the snippets:

    screen shot 2018-10-16 at 10 12 48 am

    The reason the snippet provider doesn't have code like you linked, is that it's related to trigger characters. For the non-Snippet provider, we register it like this:

    context.subscriptions.push(vs.languages.registerCompletionItemProvider(filter, completionItemProvider, ...triggerCharacters));

    The last parameter there is a set of characters that will automatically trigger the completion. We include characters like { in there, but we don't want completion to open when typing that inside strings (for example), so the code you found is to bail out if we think we're somewhere that completion wouldn't make sense.

    However, the snippet provider is registered differently:

    context.subscriptions.push(vs.languages.registerCompletionItemProvider(DART_MODE, new SnippetCompletionItemProvider("snippets/flutter.json", (uri) => util.isFlutterWorkspaceFolder(vs.workspace.getWorkspaceFolder(uri)))));

    These don't have any trigger characters, so won't cause the completion list to open on its own.

    That all said - the snippets in your list are Dart snippets, and those are provided to VS Code in a JSON file that doesn't go through any of our code at all:

    https://github.com/Dart-Code/Dart-Code/blob/master/package.json#L62-L67

    Is there anything in the completion list besides the Dart snippets? Could you post a full list of compare it to the snippets file?

    (Also, please confirm your VS Code and Dart extension versions).

  4. DanTup commented on Oct 16, 2018

    @DanTup
    Member

    I've opened #1256 about the issue I mentioned above, and fixed as part of #1256. I'm not sure it's what you're seeing though - but feel free to try out master if you want - just clone this repro, open the folder in VS Code and hit F5 and it should launch the VS Code Extension Development Host with the extension running inside it.

  5. nklayman commented on Oct 16, 2018

    @nklayman
    Author

    For some reason, i'm not getting the issue anymore, even without the new changes. I have no idea why it started working all of a sudden. Anyway, I will close this issue. Thanks for the quick response!

  6. nklayman commented on Oct 16, 2018

    @nklayman
    Author

    I think it was a bug with vscode, as the only thing I did before it started working was updating to a new insiders version. Sorry to bother you with a bug that wasn't even your fault.

  7. nklayman commented on Oct 16, 2018

    @nklayman
    Author

    I remember it working fine in JS though. Anyway, it works now.

  8. DanTup commented on Oct 16, 2018

    @DanTup
    Member

    No worries - thanks for reporting anyway; I'd rather a report that turns out to be nothing than not know about a possible bug (and also without this I wouldn't have fixed the bug I spotted above)!

    Glad it's sorted anyway, if you do see it again, do let me know. Insiders releases can be a bit volatile, but we've been hit with breaking changes in them before, so I'd still encourage raising issues you find when using it! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions