When I type
some C++ code //
and any other symbol comment auto moves to previous line, so
some C++ code // comment to code
turns into
// comment to code
some C++ code
How can I disable it?
Configure Source Formatter, don't forget to check both kate instruction boxes ( add and override indent mode). Then reformat your files. Now everything is fine!
Related
My IDE is IntelliJ and my laptop is Mac OS.
When I click Code -> Reformat Code, even if I am not highlighting any code, the whole file gets reformatted.
How to make it format nothing if no code is highlighted?
Thank!
The behavior is expected, see corresponding help page:
If you don't want any of the code reformatted, do not invoke the Reformat Code action.
You can always undo the misfired reformatting with Meta+Z.
In basically any language, like css/scss/js I can select a block of text and use the editor.action.blockComment action to surround the text with /* */, and that works fine, but to remove it I have to select the comment EXACTLY and activate the command again. I should be able to just put the caret anywhere inside the commented section and hit the key and it will be uncommented but that just puts another comment inside it. I even tried it in Sublime and it uncomments it perfectly as long as the caret is inside the commented section.
Please help! What am I doing wrong? There's no way that’s just the way it is.
Thanks in advance!
~Neil
I'm on the VSCode team.
As of VSCode 1.9, what you describe is the expected behavior of toggle block comment. If you would like to see this improved, please open a feature request and we'll take a look. This issue already describes a similar problem.
I have my Qt Creator 3.1.1 setup to indent with 4 spaces on Tab, but for some reason tab key doesn't work when I edit CMakeLists.txt. This only happens when I open it with CMake Editor, it works when I use Plain Text Editor. Is this a bug or I need to configure it somehow to make Tab key work?
I had exactly the same problem.
This issue occured because I have enabled auto-indent. The value in the "Preferences->Text Editor->Behavior" tab "Typing->Tab key performs auto-indent" was set to something else to "Never".
So to fix this issue you you need to set "Tab key performs auto-indent" to "Never".
Additionally to the answer above, inside 'Options' window and 'Behavior' pane, have a look at 'Tab Policy' section as well as 'Cleanups upon Saving' - and check if it is really what you expect.
For me the settings there were not what I have expected and it was triggering issues, eg. in a Makefile, first command of a task looks like line continuation for Qt Creator so, upon saving, it was "cleaning" (= breaking) the indentation by replacing it with 4 spaces, that was incoherent with overall indentation in the script. Et voilà - error, make didn't work correctly!
As always, it is a very nice tool but one needs to know how to use it...
In matlab if you highlight a section of code and press cmd+i on mac it corrects all the indentation.
Is there a similar command for xcode? Say I have a for loop inside a while loop inside a method, yet each line is flush on the left, can I highlight it all and get the tabbing fixed?
Yes, you can do that in Xcode as well - default shortcut for that is ctrl+I
It is control + i for Xcode.
Also select the code and right-click and Structure
I'm looking for a simple feature or work-around that can highlight commented program code as opposed to technical notes. Is there such a feature or other way to do it?
I want this to appear in light gray, as normal:
//avoids a ClassCastException. See bugfix #123
I want this to appear in orange so that it can safely be removed (the history for which would be under version control):
//public static void method() {
//}
I searched SO but no luck.
There is no such feature in IntelliJ Idea. Fortunately, there is even better way to avoid commented-out sections of code in your project.
The best option is to use Static Code Analysis tool such as Sonar - it has a rule which detects commented-out lines of code and reports the issue to you. After running such tool you can be certain you have no commented-out dead code in your project.
See the post about Commented-out code eradication with Sonar.