Remove automated closing bracket comments in IntelliJ IDEA - intellij-idea

I'm seeing following happen when working in intelliJ IDEA with Dart based project
All comments there i.e // AppBar are auto generated, I assume for easier tracking of what closing brackets belong where. Weird bit is that I can't even highlight them, nor delete them and when I copy code they are not copied over.
Is there a way to disable this feature in the ide?

The checkbox is in Settings (Preferences) | Editor | General | Appearance, toggle 'Show closing labels in Dart source code'.

And in the vs code editor, change this setting to false
"dart.closingLabels": true
You can find this setting easily. Go setting and search(Ctrl+f) dart.closingLabels
Update 24.11.2019:
If you want to customize the closing label color, you can do this. In vscode, open your settings.json file and set this setting
"workbench.colorCustomizations": {
"dart.closingLabels": "#FF5733"
},

Related

PhpStorm AutoComplete code is not working

I'm using PhpStorm over 3 months and it's a good IDE. I do not know what I've clicked yesterday but since yesterday I have issue with code completion in CSS mainly.
On the screen I have VS Code and PhpStorm and also I've opened the same project.
In VS Code it works perfectly. In PhpStorm it doesn't. I tried some Google First Aid like clear cache, update the IDE, turn On/Off Safe mode etc. but nothing changed.
My Code Completion settings:
Based on your PhpStorm editor area screenshot (many thanks for that BTW: not many people do post it even if asked), all your CSS files are treated as a Plain Text. It's rather unlikely to be a glitch, more like accidental settings change.
Settings/Preferences | Plugins -- make sure that CSS plugin is enabled. If not -- enable and restart the IDE.
If still the same: Settings/Preferences | Editor | File Types -- locate "Cascading style sheet" entry and make sure that it has *.css pattern there.
If not there -- it's possible that you have somehow reassigned it to "Text" file type. If it's there -- just add *.css to Cascading style sheet patterns (it will remove it from Text when doing that).
If still nothing: you would need to provide more/new screenshots.

How to enable sidebar changelog in WebStorm?

Today I added Material Theme plugin to WebStorm and I believe this is the reason behind changelist not appearing on the sidebar.
To be precise, this is what happens in IntelliJ when I make change to a specific line of code and click on the yellow bar that appeared after I removed the semicolon:
The change I made can also be seen under VCS -> Local History -> Show History menu option, which shows the diff between the previous and current version of that file.
However, performing the same action in WebStorm doesn't show the changelist/diff on the sidebar:
which means that the only way I can see it is by going to VCS -> Local History -> Show History which is very tedious:
I found being able to quickly revert/lookup the changes on the fly by clicking on that coloured bar really handy, could someone tell me if there is a setting in the IDE that enables that? I looked up and down but couldn't find anything relevant, perhaps I wasn't looking for the right keyword.
Thanks in advance.
Change markers are there for me when using Material UI plugin. Do you have Highlight modified lines in gutter enabled in Settings | Editor | General?

Disable copying entire line when nothing is selected in Intellij

I have recently started using Intellij and I noticed that by default, when you do ctrl+c for copying something when you have nothing selected, it copies the entire line into the clipboard overriding what I had in there before.
This is really annoying yet I cannot seem to figure out how to disable it. I am aware that there is a paste history you can use however this is not what I am after, I just want to disable it like you can do with sublime text.
Is there a way to disable this behaviour so that when I press ctrl+c and nothing is selected it just leaves the clipboard alone?
Since version 2021.2 there is a dedicated Don't copy/cut the current line when invoking the Copy or Cut action with no selection setting for this in Preferences | Advanced Settings on the Mac, Settings | Advanced Settings on other platforms.
For older IntelliJ Platform based IDE's the setting is more hidden:
Invoke Help | Find Action... (Ctrl (Cmd on Mac)+Shift+A), type Registry and select the Registry... item that appears. Enable the editor.skip.copy.and.cut.for.empty.selection option there. Be careful with the other configuration options, because it is possible to break your IntelliJ IDEA installation with an incorrect setting.
In Mac OS X:
Press cmd+shift+a.
Type registry and press return to
open the Registry.
Enable the editor.skip.copy.and.cut.for.empty.selection option.
Click Close.
I suppose it should be same as in WebStorm, or someone might be searching WebStorm solution as I did:
Open the settings: File > Settings > Advanced Settings (bottom of the list).
Start typing "editor".
Check the editor.skip.copy.and.cut.for.empty.selection
Click "OK" or "Apply"
On: WebStorm 2022.3.1
in PHPStorm -> From the Help menu, select Edit Custom Properties.
and paste
editor.skip.copy.and.cut.for.empty.selection = true

Resetting IntelliJ refactoring defaults

I have set some defaults on IntelliJ's method renaming functionality [specifically 'rename string usages'] and its causing me pain.
How do I remove these defaults? I can't find it in the project settings
Use the Refactor | Rename keyboard shortcut twice to get the dialog with options:
Note the hint at the bottom of the popup.

Disable reformatting code when saving files

I made a small change to an old java file in IntelliJ and when I save the file the IDE automatically reformats all the code. Normally this would be preferable, however it seems almost every line has unnecessary white space that gets cleaned up. Now it appears the entire file was modified even though I only made a small fix. This will make looking at the significant changes in VCS more difficult.
Is there a way to disable code reformatting when a file gets saved? So far I haven't had any luck finding the setting in the Project Settings dialog. I'm using IntelliJ IDEA 9.0.2
Alternatively I could perform the reformat, commit the changes, and then make my modification but I feel that this will end up happening a lot and I don't want to impose my formatting preferences on code owned by other groups.
Settings | Editor | General > Other | Strip trailing spaces on Save -> None.
Updated for IntelliJ Idea 2021+
Settings | Editor | General > On Save | Remove trailing spaces on: <...> -> None.
For newer versions (at least WebStorm 2018), Ctrl + S is bound to a save Macro that has a reformat code action followed by save.
You can remove this reformat with Ctrl + Shift + A search for Macro then modify the save one.
Edit | Macros | Edit Macros | save | - on the Action: Reformat...
You can add these comments to make it temporarily disable formatting on the file, or a specific function:
// #formatter:off
If you want one section to remain, you can also add this:
// #formatter:on
IntelliJ Documentation Link
If #formatter:off is not working, you can enable it in preferences:
Today in 2020 IDEA is silently formatting HTML before commit, which might break your web pages appearance. To disable that unselect this checkbox:
Preferences -> Tools -> Actions on save -> uncheck "Reformat Code"
Settings > Tools > Actions on save > first line with checkbox "Reformat code"
change "Whole file" to "Changed lines"
As it advertise only the modified lines will be affected by formatting on save.