Skip to content

Intellij IDEA: Complete Statement action doesn't put the caret inside the method #264

Open

Description

@vplagov

There's a feature in Intellij IDEA: Complete Statement. Start typing method declaration, like: public void myMethod() and press Ctrl-Shift-A, that will open curly braces and will put the caret inside those curly braces with respective indentation. So the code will look as follows:

public void myMethod() {
  
}

But with google-java-formatter installed and enabled, version 1.5, this shortcut and action doesn't open curly braces and doesn't put the caret inside the method. Instead, the code looks like follows when I press the shortcut after typing ... myMethod():

public void myMethod() {}

So the method is closed and the caret is below outside the method.

The expected behaviour would be to open the curly braces and have the caret inside the method as was described in a first example.

Activity

  1. self-assigned this
    on Mar 30, 2018
  2. plumpy commented on Jun 4, 2018

    @plumpy
    Collaborator

    CodeStyleManagerImpl has a (complicated, and private) CaretPositionKeeper class for this. We could maybe do something similar. To be honest, it's not likely to be something I'm going to be able to get to anytime soon, sorry. It would be nice, though.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions