Intellij 11 not respecting Code Style changes!
I'm writing an ActionScript project and there's one thing that Intellij IDEA does that I do not want it to. Intellij inserts a space after I type a comma in the function parameters (like func(a,<automatic space>b)). While I do like spaces after my comma, it's pretty much habit for me to insert them myself. The problem is, I end up often with two spaces! Which does take some time to constantly go back and delete one of the spaces.
I found the Spaces tab, under Code Style -> ActionScript, and unchecked the "After comma" field under Other. However, the IDE still inserts the space! To further test things out, I checked "Before comma" and the IDE doesn't insert that space. Either I have the wrong settings or the IDE doesn't appear to be respecting the changes.
While I could get used to not inserting the space, I use other IDEs for other languages that don't give me that option so I'd rather keep consistency and insert the spaces manually.
Help?
Thanks,
C.J.
请先登录再写评论。
Most code style settings do not apply (i.e. are not 'activated' or 'enforced') while actively typing. They only apply when IDEA auto-generates code, when you paste code (if so set in Editor > Smart Keys > Reformat on paste), and when you invoke the format code action. So regardless of the"after comma" setting I can type foo(x,y) or foo(x, y) and IDEA will not change it until I invoke the format code option.
The behavior you describe will happen if you use the comma key to select an item from the code completion suggestion list. (This is true even if you have fully typed the parameter and it is still selected in the code completion suggestion list.) I suspect that is when the issue happens for you. To verify that, type a function and enter garbage that would not be found in the suggestion list: func(aaaaa,bbbbbb) You should see that a space is not added after the comma. Using a comma to select a code completion option is a feature that allows you select an item, enter the comma, and enter a space in one key stroke. Unfortunately, this action does not directly honor the "after comma" code style setting (until you reformat the code). Nor is there a way (as far as I know) to change that behavior. You can submit a feature request (http://youtrack.jetbrains.com) to allow you to set whether the space is added or not when using the comma to select a code completion option.
For now, your options are:
I hope that helps.