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.
Related
in IDEA ,I can type soutto represent System.out.println();and I want to know how to make my own code abbreviation.For example, alias System.out.print(); to sounor any other names
This is called a Live Template in IntelliJ.
Go to File > Settings > Editor > Live Templates. From there, select Java and on the right, you'll see a plus sign. By clicking it, you'll get a 1. Live Template and that will get you a new abbreviation.
Name it soun and the text should be
System.out.print($END$);
Once you're done, make sure you've enabled that abbreviation by clicking the check box next to it.
The docs of IntelliJ cover in detail what the syntax is for these templates.
The $END$ syntax indicates the position of the cursor when the code snippet is complete, and you can no longer press Tab to jump to the next variable.
There are more variables to look at as well and other configurations to do!
Edit: there is an answer here for this question, but it looks like it doesn't necessarily answer the question asked on that post, so that's why I've decided to post a dedicated answer (tackling the issue at hand).
I'm using AppCode for Objective-C development. It seems like one of the recent updates has changed the behavior of how indents work after a comment.
Now, when I add a comment and then hit return to enter code on the next line I get this:
Hitting return again will keep the same level of indent, and hitting delete just returns the cursor to the comment line.
What I want is:
// Comment
self.theCodeStartsHere;
which I thought used to be the default.
I have also noticed that when I try to break a statement into multiple lines they no longer line up on the colons. I'm not sure if it's related, but the behavior seemed to start around the same time.
Any help would be appreciated!
After posting on YouTrack, this issue seems to be fixed in AppCode 2018.2 EAP.
EDIT: YouTrack Issue Link.
Xcode's desire to complete certain things drives me nuts. If I type "else" and hit return, for example, I want to just end up on the next line after my "else", but instead I accidentally select Xcode's "else" completion and I'm still on the same line, which is literally never what I want. I like code completion in general, it's these ones that effectively replace normal code typing that bother me. Is there a way to disable specific completions in Xcode 6? This question asked basically the same thing (the author was even also bugged by the "else" completion – seriously, Apple, please remove that one), but all of the answers to it are out of date and do not apply to Xcode 6. (I would have just commented on that question, but doing so requires 50 reputation, so I had to start a new question instead, grr.) Xcode 6 has the macro browser thing where you can add new completions, but it does not seem to be possible to disable their built-in completions there. Is there a config file somewhere that can be edited?
The problem that Xcode doesn't have completion snippet for "else" statement. It has only for "if" and "if - else" statements.
I propose to create custom snippet for your goal.
Here is an example how it should look like:
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...
Some IDEs offer the feature to automatically format a line or block of code after finishing it e.g. by writing the closing curly or semicolon.
I find it hard to believe that IDEA does not offer this kind of feature. Or does it?
If you know how to turn it on - or if I maybe need some plugin - let me and the world know, please!
If it's a single line, you can use the Complete Current Statement action (which adds a closing bracket, semi-colon, and so on) with ctrl-shift-enter - this seems to reformat the whole line.
Otherwise, you can obviously rebind ctrl-w and ctrl-alt-l (to reformat selected text) or just ctrl-alt-l (reformat whole file) to faster / easier keybindings so that you can quickly reformat whenever you want to.
There is no automatic reformat feature, related requests:
IDEABKL-5806 Automatically trigger code formatter on file save
IDEABKL-475 Hard (auto-)reformat code
See also my answer to the similar question with the Complete Current Statement workaround.