Autoformat code CTRL+SHIFT+L add a space, between ending quote and parenthesis of string - intellij-idea

For example when my code says:
System.out.println("Printing demo features");
I use CTRL+SHIFT+L and Intellij make this:
System.out.println("Printing demo features" );
Thanks for your help.

It looks like you have custom code styling in place for Java, thus the auto format function tries to match it:
Check Settings > Editor > Code Style > Java > Spaces and look for "Within" grouping. See if you have some options marked like "Method call parentheses". If you don't have any custom style in place, simple reset the Java style to default and it should be "fixed".
Obs.: I am on Intellij14, options might be different.

Check off Settings > Editor > Code Style > Java > Spaces > Within > Method call parentheses
If above didn't help: "File" -> "Invalidate Caches / Restart..." (sounds unrelated, but in my case actually solved it)

Related

Unexpected whitespace between function name and paren.(func-call-spacing), A space is required before '}'.(object-curly-spacing), webstorm quasar vue

I'm new to using stackoverflow and using WebStorm quasar,and vuejs, so let me know if you need any more details or if I did something wrong.
pictures of code errors:
https://drive.google.com/drive/folders/13oSjnK6Q21ztsihbcF0a-TUUAWAo0vcW?usp=sharing
errors:
ESLint: A space is required after '{'.(object-curly-spacing)
enter image description here
ESLint: Unexpected whitespace between function name and paren.(func-call-spacing)
I correct these errors by adding the correct spacing, but whenever I refresh the website, I'm working on, WebStorm changes them back.
I believe its some sort of a formatting error.
I've gone into,
Settings->Editor->Code Style -> JavaScript
Settings->Editor->Code Style -> TypeScript
and clicked on spaces, and check the appropriate boxes.
spaces - before parenthesis - function call parenthesis
spaces - within - object literal braces
but the problem still persists.
You should have disabled the Spaces > Before parentheses > Function call parentheses and enabled the Within > ES6 Import/Export Braces in Settings | Editor | Code Style | JavaScript; please also make sure that you don't have the IDE code style preferences overwritten by the settings in project .editorconfig (if any)

IntelliJ IDEA: is there a way to format java code in a canonical way?

I have two java source files. Both represent the same class (semantically), but they were formatted differently.
For example, one of them contains the following line:
return Boolean.valueOf(Boolean.getBoolean("abc"));
While in the second file it looks like 2 lines:
return Boolean.valueOf(
Boolean.getBoolean("abc"));
In both cases, when I apply formatting (Ctrl+Alt+L), these lines do not change.
Is it possible to format them in some canonical way: that is, to get the same code if the only difference is formatting?
Equivalently: is there any way to remove all ignorable whitespace? Such a 'dried-out' program would then be easily restored using 'Reformat code'.
You should be able to do this if you turn off "Wrapping and Braces | Keep when reformatting | Line Breaks" in the Java code style settings.
Go to File > Settings > Ediotor > Code Style > java
in tab Wrapping and Braces uncheck line breaks
Apply and make (Ctrl+Alt+L) again.

How can I set Idea collapse too long string?

Look at Eclipse:
and in Idea:
So, how can I make Idea collapse multiline String like Eclipse?
Unfortunately, it seems there are no folding options for string literals.
You could try using custom folding tags, but this could will require extra comments for every string:
To check all existing folding options go to Settings > Editor > General > Code Folding.

IntelliJ, Java formatting: force empty blocks to be on one line

Is it possible to tell IntelliJ to put empty block on one line when formatting Java files.
I'd like this:
#Override
public void onClickPositive(int tag, Object payload) {
}
To automatically become this:
#Override
public void onClickPositive(int tag, Object payload) {}
There is no way to do it for reformatting code.
This can only be done manually.
Check your Code Style settings, under "Alignment and Braces" to preserve your formatting.
You should find a "Simple methods in one line" option there. Check it and clear the "Line breaks" check box.
Enable following Simple blocks in one line code style in settings.
Settings > Editor > Code Style > Java > Wrapping and Braces > Keep when reformatting > Simple blocks in one line
You can remove the unnecessary line breaks more universally throughout a project than just remove the newline before curly braces.
First go to the following setting and set a larger value for hard wrap:
Settings > Editor > Code Style
The default is 120. Change it to 250 or any other large value.
Next, navigate to the following setting:
Settings > Editor > Code Style > Java > Wrapping and Braces > Keep when reformatting > Line breaks
Uncheck "line breaks"
Finally, go back to your file and try to reformat the code.
This removes all the unnecessary line breaks that have been put into the code.

How do I indent multiple lines at once in Notepad++?

In many text editors that are aimed at programmers, if the user has a selection that spans more than 1 line and presses the TAB key, those lines are indented by 1 TAB (or a number of spaces, depending on how the editor is configured).
However, this does not seem to be the default behavior of Notepad++. Is there a way I can do this in Notepad++, or is there a plugin that I can get to allow me to do this?
Edit: Upon additional testing, SHIFT-TAB correctly un-indents the lines as expected, but only a tab simply inserts a tab wherever the carat is. This is in version 5.4.5 Unicode
The problem was with the QuickText plugin. After removing it, indent worked as normal.
Capslock + Tab to indent multiple lines at once. Highlight the text first.
The problem with the new version of QuickText seems to be that it is set to react to the TAB key. Previously it was set to use CTRL-ENTER. If you change the key combination in the shortcut mapper then your TAB key should start working again, and QuickText should also work (with whatever new key you've assigned).
It works fine for my v. 5.4.5 of Notepad++. I just select multiple lines and press TAB.
If you want TAB to be replaced by SPACE than you need to go Settings > Preferences and select Edit Components tab. Next check Replace by spaces check box in Tab Setting section.
Update: In a newer version of Notepad++ this option is in Settings > Preferences > Language section.
If you're using QuickText and like pressing Tab for it, you can otherwise change the indentation key.
Go Settings > Shortcup Mapper > Scintilla Command. Look at the number 10.
I changed 10 to : CTRL + ALT + RIGHT and
11 to : CTRL+ ALT+ LEFT.
Now I think it's even better than the TABL / SHIFT + TAB as default.
I have Notepad++ 5.3.1 (UNICODE). I haven't done any magic and it works fine for me as described by you.
Maybe it depends on the (programming/markup/...) "Language"?
Just install the NppAutoIndent plug-in, select Plugins > NppAutoIndent > Ignore Language and then Plugins > NppAutoIndent > Smart Indent.
Notepad++ will only auto-insert subsequent indents if you manually indent the first line in a block; otherwise you can re-indent your code after the fact using TextFX > TextFX Edit > Reindent C++ code.
in Notepad++v6.1.8 (Unicode) it works after removing the QuickText plugin.
To increase indent - Press and hold TAB
To decrease indent - Press and hold TAB + SHIFT