I am facing a weird issue in IntelliJ that whenever I entered double quotes it will automatically converted into either 3 double quotes or sometimes it is converted to some Unicode letters.
For example, if I enter A after " then the text would change into something shown in the image.
I am using macOS 10.13 High Sierra. Thanks in advance
I had the same issue and the problem was not in IntelliJ IDEA but in keyboard input source on MacOS.
The reason of issue: I was using "U.S. International - PC" keyboard on MacOS. When I changed it to "U.S." the issue was gone.
Steps to solve the issue:
Go to System Preferences -> Keyboard -> Input Source tab
Click on + button -> add "U.S." input source (or "British")
The default behaviour of IntelliJ IDEA is to saving you time by inserting a pair of quotes when you type the opening quote. This is controlled by Settings -> Editor -> General -> Smart Keys.
The funny characters appearing in your case may be due to some weird setting. Try going to Settings -> Keymap.
Related
I am using Intellij IDE on Windows 7. Here Shift + Up / Shift + Down is not working for Line selection operation. How to get this, as it is default way in other editors.
Thanks in advance.
You can change the key mapping in the settings (File -> Settings). Type in the search box (upper left) keymap. When on the keymap settings page find in the tree Main menu -> Code. There you find the Move Line Up and Move Line Down. Make a right click and select add keyboard shortcut to assign what you want. Most probably SHIFT-UP is already assigned to some action. It's up to you if you want to reassign it.
Within our team, we have an eclipse formatter profile that we are using for some years. It seemed to work fine within Eclipse Neon, but today I discovered that the formatter is no longer "trimming" empty lines.
When using older versions of eclipse, running the formatter simply trims lines that only contain spaces. The line is still there, but the spaces are all gone after formatting.
I checked the formatter options; but I can't find a checkbox that would match.
For the record: I saw this, but using "trim on save" is a no go for me: very often I have to make subtle changes in files from other people; and I intentionally do not format those files; because the diff would be huge. And for the same reason, I don't want that "save" trims empty lines either. Before Neon, I would press ctrl-f on purpose; also to trim lines; now it doesn't have that effect any more.
Any idea where to fix that?
As the answer says in the linked question, you could do on save for only lines you have changed
Removing whitespace only from the lines I changed:
Preferences -> Java -> Editor -> Save Actions -> check "Perform the selected actions on save" -> check "Format source code" -> select "Format edited lines".
I have this line showing the problem:
Which setting in the Eclipse Java formatter do I have to change so the line will break like
return this.data.getNumberOfGenerationsWithoutSignificantImprovementPassed()
> MAX_NUMBER_OF_GENERATIONS_WITHOUT_SIGNIFICANT_IMPROVEMENT;
or like
return this.data.getNumberOfGenerationsWithoutSignificantImprovementPassed() >
MAX_NUMBER_OF_GENERATIONS_WITHOUT_SIGNIFICANT_IMPROVEMENT;
? If both is possible, I prefer the former.
On Mac, go to Eclipse -> preferences. On Windows, I believe it is Windows -> preferences... but don't quote me on that!
Expand Java -> Code Style -> Formatter
To the right of the "Active profile" bar, choose edit.
A new window will open- choose the "Line Wrapping" tab.
Scroll down to "Expressions" and choose conditionals. Pick your favorite!
Bonus points: This is where you can set all sorts of different styles, if you have not before, like number of spaces per tab character. Once you get everything set up just right, name your profile and export it. I use the same theme on 3 different computers and the consistency is nice!
Could anybody share their eclipse formatter settings file or point me to such a file which will prevent my eclipse from doing the following thing:
when I press ctrl+shift+F to format my code, eclipse from this string:
dayArrayList.add(new Day(WeekDay.SATURDAY));
the following string:
dayArrayList.
add(new Day
(WeekDay.SATURDAY));
So I want only really looooooooooong code strings be moved to next line (those, which don't fit into the eclipse window), but eclipse do this almost with all strings.
Thanks in advance!
Simply increase the Maximum line width to let's say 140 chars?
The following formatter does this.
In Eclipse go to Window->Preferences->Java->Code Style->Formatter
Then Create a new profile and in the Line Weapping Tab you have the Parameter "Maximum line width"
You can set the maximum line width in eclipse by:
Window -> Preferences -> Java -> Code style -> Formatter -> Edit
On line wrapping tab, change the default 80 to your preference. Note that you will have to save as a new profile if you are changing the default one.
I'd like to do this:
System.out.println("안녕하세요!");
But I get a "Some characters could not be encoded using the MacRoman character encoding" popup error message when I try to compile in Eclipse. I'm running Mac OS X. Is there a way to get around that?
So, I guess I'll try using Unicode:
System.out.println((char)0xD0A4);
Which I'd like to print out '키', but instead get a '?'. I guess the command line doesn't support Unicode. But even if it did, it'd be really annoying to have to go to one of several charts (like this one) to find each character block.
Anyway, FINE! So I'll use a JLabel...
JLabel lbl = new
JLabel(""+(char)0xD0A4);
Awesome, this prints out 키! ... but I still have to look up the Unicode characters for each block. How can I easily spew out Korean characters in a program?
Switch to UTF-8, as said before.
However, instead of doing it on a per-project basis (as J-16) suggests, go through
Window -> Preferences -> General -> Workspace and change the "Text file encoding" to "Other: UTF-8".
This changes the setting for the entire workspace.
Afterwards, you can input your characters as you are used to.
The Eclipse console doesn't use unicode encoding so it can't display those. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=13865.
Try the fix mentioned here: http://paranoid-engineering.blogspot.com/2008/05/getting-unicode-output-in-eclipse.html
Just right click the file in the project view, choose properties. Change the encoding to UTF8 there.