Skip to content

Use completion commit characters so ( is only inserted when used to commit #2125

Closed

Description

@vogella

If I code complete on "_saySomething" I get _saySomething() which the compiler immediately complains about.

    return AppBar(
          title: Text("Super application"),
          actions: [
            IconButton(
              icon: Icon(Icons.access_alarm),
              onPressed: _saySomething,
            )
          ],
        );
  }
 void _saySomething() {
    print("pressed");
  }

Activity

  1. DanTup commented on Nov 26, 2019

    @DanTup
    Member

    This is essentially a dupe of #687. We don't really have the context to know when a user is completing a function of whether it'll be correct to include parens on the end. The ideal solution IMO is that we never insert the parens, but if you're calling the function then you use the ( key to commit the completion (which would also insert it, and the closing one).

    This is possible if you disable insertArgumentPlaceholders and turn on completionCommitCharacters, however there are other quirks in that behaviour which may make it worse (ultimately, I think that should be the end goal though).

    I'll leave this open as a reminder that this still sucks (since the other issue is closed) and I'll try to work through the remaining issues that make using commit characters bad (or at least document the specifics).

  2. added this to the v3.8.0 milestone on Nov 26, 2019
  3. modified the milestones: v3.8.0, v3.9.0 on Jan 16, 2020
  4. modified the milestones: v3.9.0, On Deck on Mar 24, 2020
  5. modified the milestones: On Deck, Backlog on Jul 2, 2020
  6. changed the title [-]Code completion creates wrong results for methods assigned to void properties[/-] [+]Use completion commit characters so `(` is only inserted when used to commit[/+] on Sep 7, 2020
  7. modified the milestones: On Deck, v3.15.0 on Sep 7, 2020
  8. DanTup commented on Sep 22, 2020

    @DanTup
    Member

    I've added a preview flag to enable these when using LSP, though in my current testing it doesn't seem to be working. I've opened microsoft/vscode-languageserver-node#673.

  9. modified the milestones: v3.15.0, v3.16.0 on Sep 22, 2020
  10. added
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    and removed on Oct 21, 2020
  11. DanTup commented on Oct 21, 2020

    @DanTup
    Member

    With https://dart-review.googlesource.com/c/sdk/+/168653/, this is supported in LSP with the dart.previewCommitCharacters setting. I've opened #2895 as a reminder to enable it by-default in a future release.

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

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions