How do I change selection properties in Jetbrains IDE(s)? - intellij-idea

Several times, while working with Jetbrains' IDE(s), I have faced the following issue:
The natural selection type is changed to this kind of a selection. When I reload the IDE, it gets back to its normal position. Is it a bug, or a feature of the IDE? How do I fix it?

From Jetbrains:
Toggling between line and column selection modes
To toggle between the line and the column selection modes, do one of the following:
On the main menu, choose Edit | Column Selection Mode.
On the context menu of the editor, choose Column Selection Mode.
Press Shift+Alt+Insert.
P.S. My guess would be you by accident used the wrong key combination. (I currently use PHPStorm & C-Lion and have not seen this issue)

Here is the documentation for selecting text in Jetbrains' editors.

Related

How to use Option in Intellij Keymaps?

I am trying to add Option-i | u for "Find usages" as shown in this dialog (Note that the "i" is lowercase - shift is not depressed):
But after having selected OK and then going back into Actions we see that the setting did not "take":
Note: I do have custom keymap entries to use Option- for accessing Main Menu items. But why is Option not working in this case? Is there a workaround?
On macOS, "Option" is used for typing special characters, thus when editor is focused and you hit Option-I the shortcut you assigned won't work (it will type a character instead).
However, when no editing field is selected, the shortcut should work (e.g. from tool windows).

PageDown in Column Selection Mode in Intellij/PyCharm

Column Selection Mode is a great feature of Intellij (/Pycharm etc). I just noticed that it stops working when I hit page-down with select. Is this a known issue? it is possible that it could be platform specific. I am on mac-os and had to customize page-down-with-select to have it usable on my macbook pro that has limited keys available.
Just discovered I had been using Move Caret Down with Selection and not Page down with Selection. I made a custom shortcut for the latter and now column selection is able to span multiple pages!

Adapt the extend selection in IntelliJ

Everyone knows that when you select some text in IntelliJ and press Ctrl+w your selection is expanded.
However,
you're kinda stuck on the presets for this:
when you have following code:
<a4j:commandButton execute="#form" render="tableProperties"
value="#{cjr_main.addExtractType}"
action="#{ExtractTypesBean.addExtractType()}"
styleClass="bigButton"
oncomplete="setLineAdded();"/>
and "Line" is selected but the method setLineAdded() is not yet defined you'd want "setLineAdded()" to be selected after hitting ctrl+w a couple of times.
However
Once "setLineAdded" is selected, and you press ctrl + w the whole tag is selected in stead of the accompanying "()"'s...
Is there a way to get this behavior?
(without writing a whole IntelliJ plugin just for this?)
best regards,
S.
No, the behavior of extend selection is controlled by code and is not configurable by users. You can indeed write a plugin to change the behavior.

Wrapping comments with line breaks in PyCharm

I have comments that gets balloon (PEP 8: Line too long ... > 120)
I wish there was a command that will wrap the lines with few keystrokes.
Right now, even if I type Alt+Enter and press enter on Reformat file, nothing actually changes. Is there a setting or plugin I could use to accomplish the formatting easily?
Under the Edit menu, there is a Fill Paragraph option, which does what I believe you want. You can assign a key command to this in Preferences, under Appearance & Behavior -> Keymap (search for "fill").
Personally, I choose first stroke Esc, second stroke Q, because that's what I've always used in Emacs...
Firstly, reformatting won't work, not in Python at least, where whitespace is important. PyCharm's "Wrap when typing reaches right margin" option is what you're looking for. Now this will not work when you copy and paste code, but in the places where it gives you trouble, just press enter, and it will work.
To be able to auto-reformat comments (and code, for that matter) to honor a right margin after the fact, go into Project Settings under Code Style and then further under Python. Click the Wrapping and Braces tab, and check the "Ensure right margin is not exceeded" checkbox.
Now if you select a region of lines and then run the Code/Reformat Code... command, PyCharm will do its best to wrap the comments or code appropriately.
You will probably have to do some tweaking of the results to suit your stylistic taste. For example, I wish PyCharm would do aggressive filling of text in block comments, at least optionally so.
PyCharm will not reformat code such that it becomes invalid Python, so sometimes it will still leave a line longer than the margin (120 or whatever you set under Project Settings/Code Style/General).
With recent PyCharm this now is located at "Editor -> Code Style", with the checkbox named "Wrap on typing"
The Screenshot shows PyCharm version 2016.2.1 Professional.
Updated Answer:
Use "soft wraps." You can search for it in the help bar.
View > Active Editor > Use Soft Wraps
It won't work for existing text or text that's copied in, but will for any newly typed text.

Rename using suggested var name with resharper

I'm Using resharper 6 nighty builds and VB.net. I've a big medium project with multiple files that don't follow the code style conventions of my company.
I've configured resharper with my own convenctions and It suggest to me the right name for each variable (perfect!).
But I can't find any automagic way to make the current name to be replaced with the suggested name.
Are there any way to do it? If not ... did you know ane fearure of coderush Xpress to achieve it?
Thanks.
If you've configured ReSharper with your naming conventions, then it should show a warning (blue squiggly underline) under any identifiers that don't comply. If you put the text cursor on one of those misnamed identifiers, you should see a pyramid icon appear near the left margin. Then you can press Alt+Enter (or click the pyramid icon) to drop down a quick-fix menu. There should be an option in the menu to "Rename to '_myField'". Usually it's the first item in the list, so you can just press Enter again to do the rename.
If you want to do this on everything in a source file, you can use the ReSharper > Inspect > Next Issue in File command (or its keyboard shortcut -- F12 in the IDEA keymap) to move the cursor to the next warning in the file. Then, if it's another name warning, you can use Alt+Enter, Enter again to fix it.
Unfortunately, there isn't a way to automatically fix every instance of a warning at once (though it's been requested; please feel free to vote for RSRP-126551 in their issue tracker).