IntelliJ IDEA 13.0.1, 13.0.2 (but probably applies to earlier/later versions too)
Consider the following:
Collections.addAll(
new ArrayList<Object>(),
new Object());
I do "Join Lines" since it will fit on one line:
Collections.addAll( new ArrayList<Object>(), new Object());
// ^ space is annoying ^ space is nice
"Join Line" adds an extra space between the current and next line. It makes sense for some lines, but the space before the first parameter has always bugged me.
My workaround is to select and "Reformat Code", but I don't want to do the extra step if I don't have to.
Is there a better way to make "Join Line" not add that first space?
Notes:
Edit > Join Lines
Mac OS X: ⌃⇧J
Windows: Ctrl+Shift+J
Code > Reformat Code
Mac OS X: ⌥⌘L
Windows: Ctrl+Alt+L
I suspect you have a non default formatting set. Try:
File -> Settings -> Code Style -> Java -> Spaces and uncheck Method call parantheses.
This appears to be a bug in the Code Style settings.
The bug appears—for both method declarations and calls—if you modify the Default Scheme and check the following settings:
Code Style > Java > Wrapping and Braces
+- Method declaration parameters
| \- New line after '('
\- Method call arguments
\- New line after '('
Also, there needs to be more than one parameter in the method declaration or call.
Here is the issue in JetBrains' YouTrack.
Related
When I write following code in Rider:
new List<Guid> { Guid.NewGuid() } and I type ; at the end, Rider automatically formats this into new List<Guid> {Guid.NewGuid()};
Note that spaces were removed before and after both braces.
Compiler doesn't like it and reports [SA1012] Opening brace should be followed by a space. and [SA1013] Closing brace should be preceded by a space.
How can I turn off such behavior in Rider?
I don't know which version of Rider you're using but in 2022.2.3 I had to enable the following property under File | Settings | Editor | Code Style | C#:
I hope it helps you as well!
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)
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.
If I want to comment line I use "Ctrl+/" and get the "//" at start of line
Then I use auto formatting with "Ctrl+alt+L" keys and get
At the end I must remove space between "//" and text manually every time...
Can I do all of these steps in one time? I didn't find any settings for this...
An alternative, not perfect though, is:
Editor -> Code Style -> Java -> Code Generation
Uncheck Line Comment at first column
The menu hierarchy is the one in Intellij IDEA 14.
I suggest you can use a setting to avoid the further indentation of your comment (the effect of the second screenshot).
Your comments will look like this:
// Bundle b = new Bundle();
That might not be quite exactly what you want, but at least you will be able to use "Ctrl+/" after the reformatting to return the line to a properly aligned state.
Here is the setting:
Go to Settings -> Project Settings -> Code Style -> Java
On the Wrapping and Braces tab, find the tree item at the top: Keep when reformatting and tick: Comment at first column
This works for Scala.
Preferences -> Editor -> Code Style -> Scala -> Other -> Comment Code
Uncheck Line comment at first column and Block comment at first column.
Example:
def regexTest(): Unit = {
Comment
When press comment shortcut in line 2, the above code becomes
def regexTest(): Unit = {
//Comment
Version 2020.2
When goals are displayed by Isabelle in ProofGeneral, assumptions are rendered as having brackets around them as so:
In Isabelle/jEdit, however, this seems to have changed to meta-implication arrows:
While I understand the former is somewhat non-standard, I find it much easier to read. Is there a way to modify the behaviour of Isabelle/jEdit to print out goals in the old ProofGeneral style?
The format Isabelle renders its output is determined by Isabelle's "print modes". In ProofGeneral, the default print_mode includes the brackets mode, which renders brackets around assumptions, while the default jEdit print_mode includes no_brackets, which does the opposite.
The print mode can be changed either by setting Plugins > Plugin Options > Isabelle/General > Print Mode to brackets and restarting jEdit, by adding -m brackets to the isabelle jedit command line, or by including in your ~/.isabelle/etc/settings file:
ISABELLE_JEDIT_OPTIONS="-m brackets"
This will result in jEdit displaying brackets like ProofGeneral:
Go into Plugins -> Plugin Options -> Isabelle -> General
then type in brackets in the Print Mode field.
Click Apply.
Then close out of Isabelle and restart it.
You should have brackets around your hypotheses thereafter.