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

Missing indentation in some cases when pressing Enter #492

Open
winmain opened this issue Oct 5, 2016 · 7 comments
Open

Missing indentation in some cases when pressing Enter #492

winmain opened this issue Oct 5, 2016 · 7 comments

Comments

@winmain
Copy link
Contributor

winmain commented Oct 5, 2016

Case 1: Missing indentation in class body after var or function declaration

class Test {
  var a = 5;
| // <- cursor not indented
}

Should be

class Test {
  var a = 5;
  |
}

Case 2: Broken indentation for multiline comments
I typing /**

class Test {
  /**|
}

pressing Enter and got this:

class Test {
  /**
  * |   // +1 space needed
**/     // +3 spaces needed (1 tab + 1 space)
}

The second and third lines looks broken.
How it should look like:

class Test {
  /**
   * |
   **/
}

Plugin version: Pre-release candidate 0.10.1-RC1
Idea: 2016.2

@EBatTiVo
Copy link
Contributor

EBatTiVo commented Oct 6, 2016

(For case 2)

Actually, how it should look depends upon your language preference settings. However, I believe that none of those settings match the results you are seeing.

I thought @as3boyan fixed this, but maybe we never pulled it because it only worked in v15 and higher, whereas we were hoping to find a v14 solution as well.

@winmain
Copy link
Contributor Author

winmain commented Oct 6, 2016

Thanks for your reply.
Ok, I selected Default scheme for Haxe code style and the problem still exists. The only difference is that there are 4 space indentation in Default scheme instead of 2 in my scheme.
It would be excellent if I can tune this behavior in settings, but I think it is a bug.

@winmain
Copy link
Contributor Author

winmain commented Oct 12, 2016

@EBatTiVo yes, you were right. I have made a fix for case 1, but it only works in v15 and higher.
I will try to further understand this problem.

@EBatTiVo
Copy link
Contributor

@winmain And to confound things further... the unit tests for re-alignment work correctly in all versions.

There is at least one other issue regarding this, and probably two or three. There might be some more info on those reports.

winmain added a commit to winmain/intellij-haxe that referenced this issue Oct 19, 2016
@winmain
Copy link
Contributor Author

winmain commented Oct 19, 2016

I had to copy AbstractEnterActionTestCase from the lastest IDEA to make tests pass. Personally, I don't like this decision, but it works.
@EBatTiVo what do you think?

@EBatTiVo
Copy link
Contributor

I don't mind back-porting changes like that. I definitely like to add a comment like:

    /* Lifted this file from <old_location> for <reason>. */

near the top of the file. I do a similar thing when I grab entire functions from another source repo. As long as the licensing terms match, we're good.

EBatTiVo added a commit that referenced this issue Oct 25, 2016
Missing indentation in some cases when pressing Enter #492 (case 1 only)
@EBatTiVo
Copy link
Contributor

Part 1 was fixed with commit 342b568.

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

No branches or pull requests

2 participants