How to find the name for indentation of object-attributes in .tsx-file in PhpStorm - intellij-idea

I'm editting a .tsx-file and are reaching upon this bonkers file-formatting:
... If I enlarge the window a bit, then it makes more sense:
But I would still like to change it, so value and onClick aren't aligned all that way to the right. Ideally, it would try to align them with the opening bracket (as they do), unless the opening bracket is more than 35 characters, from the line start. Or something like that.
Now, I assume that it's the TypeScript-formatting that dictates the Code Style for a .tsx-file. But when I open the settings: Editor >> Code Style >> TypeScript then there are BAZILLIONS of settings.
Which leads me to three questions:
Does anyone know what I need to change, so object-attributes doesn't follow the opening-brackets width?
Could I find the name of what I'm looking for, in some smart way? I tried hovering over the massive space, hoping that the little yellow light-bulb could shine some light on, what I was after.
Are there any presets, to be found somewhere? So I don't need to engineer a new Code Style, if I dislike the default.

Make sure that the following option is disabled:
Settings (Preferences on macOS)
Editor | Code Style | TypeScript | Wrapping and Braces
Function call arguments: Align when multiline
NOTE: It is possible that the default value has been changed somewhere since the previous version as I have seen a few questions for the same option but different language (PHP and JavaScript).
HINT 1: Did you know that you can paste your own code in the preview area and start changing options to see how they will affect it? It helps locating the right option a lot.
HINT 2: There is a special popup that shows formatting rules applied to the code. It does not show all possible options but can give you a hint what to look for. To invoke it:
Use Help | Find Action... (or Action tab on Search Everywhere -- they use to be different popups but are using the same popup nowadays)
Type adjust to filer actions
Select and invoke "Adjust code style settings" action
It will give you a popup with applicable rules (it's a limited set: may not list all).
An example for PHP code:

Related

Intellij: Highlight current block of code

I was wondering if it is possible to highlight the block of code you are working on in Intellij Idea.
There was a similar question here: Is there a way to highlight the currently active code block in Visual Studio 2010? .
So what I mean is that if you have clicked into e.g. a method or a while loop... ,the background of the whole block becomes a bit lighter or whatever.
There's already one such feature, but it's more subtle, in the form of a vertical line inside the left gutter... I can't recall whether it's enabled by default or not, but you can activate it by File -> Settings -> Editor -> General, scroll to the Highlight on Caret Movement section (about half of the page).
I looked around for a while but I have not yet found a way to change its appearance to match your description, although I personally prefer this less intrusive highlight than having all the background changed.
P.S. Not sure this is relevant or useful to you, but there was a plugin I tried a while ago called CodeGlance which offered a scrollable-map of the class:
I don't know when this feature was implemented. As of 2021, if you double click anywhere in the scope ( but not on text ), Intellij selects the current block of code ( text within two curly braces ).

VS Code Intellisense don't suggest snippet at first

I want to use code snippets in VSCode. But when I type, for example, for in javascript file, the Intellisense doesn't suggest snippet "for-loop" - I need to manually scroll the dropdown and select it. Is there any way to make VSCode to suggest snippets at first? Thank you!
UPD: I have found the person with same problem, but he has no answers - link
You need to use editor.snippetSuggestions config option with "top" value. Please, see Customizing IntelliSense article for more tips and tricks.
There is one more way to deal with this issue by setting
"editor.tabCompletion": true,
that way whenever there is a snnipet available it will use it automatically without even opening the list by using tab twice.
File > Preferences > Settings (Code > Preferences > Settings on Mac)
open "Editor" menu on the left
edit "editor.tabCompletion": true
more info: https://code.visualstudio.com/docs/editor/intellisense#_customizing-intellisense
Now that VS Code mostly abstracted away the settings.json file, you can do the instructions shown by Kavu, with this bonus tip:
go to Preferences > Settings
find the Search settings text input, at the top
type in "snippet"
The setting should be at the top of the result set:
Setting editor.snippetSuggestions to top only works for certain snippets: for but not foreach. With top, the snippet does appear higher in the completion list, but for some reason the keyword version is what is highlighted, with the snippet option scrolled out of view (and the scrollbar quickly fades, giving the impression there's nothing hidden)
The editor.tabCompletion to true approach works for both for and foreach.

Pycharm / Jetbrains product odd highlighting. Any idea what is being highlighted?

I'm having a weird problem in pycharm that I can't seem to work out.
Using the Darcula theme, I'm seeing some odd highlighting as seen in the below image
Any idea what it is? I'm thinking I must have accidentally turned on some obscure tool, but I can't spot any rhyme or reason.
For whatever reason / somehow you have injected custom language (HTML?) into DIV (?) tags (the green background).
Settings (Preferences on Mac) | Editor | Language Injections -- find and delete offending rule. It should have "Project" or "Global" in most right column (Scope) -- do not touch "Bundled" ones.
Alternatively -- Alt + Enter while having caret inside problematic place and choose "Uninject xxx" from popup menu. This will only disable that rule (which is still enough to make it work as before) .. but you better delete such wrong rule at some point later.

Ignore whitespace changes in IntelliJ changebars

I have a file from our repository where I ran auto-indent (because it was a mess), and now the whole file is marked by blue changebars (down the right hand side of the editor window), making it difficult to find my changes.
I am already ignoring whitespace changes in the diff window (as described here: Intellij and changes tab), is there a way to also do this in the editor window?
I couldn't find a way to completely ignore whitespaces, but IntelliJ (I'm using version 2016) lets you set an option to color whitespace-only changes differentely:
Editor -> General -> Different color for lines with whitespace-only modifications
which helps tremendously.
At the moment [idea 13.5] it seems that is not possible to ignore spaces in the standard editor. You can open a support ticket
We also faced this in the company due the different codestyles used, at the end we settle for:
setting a common codestyle that everyone editing the code should [actually must] follow
reformat the whole codebase to the given codestyle
recommit the formatted code [without any addition or deletion, just the reformat]
It took just a bit of time, but at the end now we are working far better. In this way from that moment onward, we would have all the time the code that would aesthetically the same trough next versions.
You can completely disable the highlight of whitespace modified lines in :
Settings -> Editor -> Color Scheme -> VSC -> Editor Gutter -> Whitespace-modified lines
And then uncheck the background color :
Essentially, you want Intellij to use the --ignore-all-space or --ignore-space-change upon a merge.
My developer team also deals with this challenge because we have different code formatting preferences. The result is every merge is painful for no reason. The team loves being able to have their code formatting, but this negates it.
As of now there is no solution. Intellij has the technology to ignore whitespace, so fixing this is really just adding a check box on the merge diff screen or even in the version control settings.
There is a feature requests IDEA-107714
Please up vote it!
https://youtrack.jetbrains.com/issue/IDEA-107714
Try this,
View --> Active Editor --> Show whitespaces
this is guaranteed to solve your problem

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.