Skip to content

intelligent movement of caret to navigate commas #2700

Open
@thefuzzyorange

Description

@thefuzzyorange

Flutter widget code has lots and lots of commas.

Would it be possible to add shortcuts to the editor that make it easier to move the caret between commas as below:

  1. a shortcut key that moves the caret past the nearest comma
    This would be very useful when defining properties for widget as often you have to press a few keystrokes to position the caret past a comma (perhaps CTRL+SHIFT+,)

  2. a shortcut key that inserts a comma at the end of current line and moves the caret to new line.
    This would be useful when defining new widgets as children as often after typing in a widget you need to go to the end of the line, insert the comma and then add then add next child.
    Similar to CTRL+ENTER (perhaps CTRL+ENTER+,)

Not sure if this suggestion is related to flutter plugin or IntelliJ itself

Version info

[✓] Flutter (Channel master, v0.9.6-pre.35, on Linux, locale en_GB.UTF-8)
FLutter plugin 29.1.3

Activity

pq

pq commented on Oct 16, 2018

@pq
Contributor

@alexander-doroshko : curious if there are existing IDEA navigation tricks that would help here?

added this to the Backlog milestone on Oct 16, 2018
alexander-doroshko

alexander-doroshko commented on Oct 16, 2018

@alexander-doroshko
Contributor

Regarding 1, IDE doesn't have actions that navigate to the next/previous comma. Some similar actions that come to my mind are:

  • Navigate Next/Previous Method. This functionality hasn't been implemented for Dart.
  • Move caret to code block start/end.
  • Move caret forward/backward a paragraph.

But neither cares about commas.

Regarding 2. If trailing comma on the current line doesn't cause a syntax error (even if nothing new is printed on the next line) then we might think about using Complete Statement (Ctrl+Shift+Enter) for this. Currently, the action only adds a line break at the end of the current line and jumps to the next line. When it brings more good than bad it might add trailing comma as well.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @pq@thefuzzyorange@alexander-doroshko

        Issue actions

          intelligent movement of caret to navigate commas · Issue #2700 · flutter/flutter-intellij