I'm using CLion for writing some C++ code, but the editor seems to be misbehaving.
First of all, it keeps inserting spaces instead of tabs, even after "converting the file to tabs" and setting both "Default (IDE)", "Project specific" settings to use tabs. (I did this for all languages and for the "General" tab).
On top of that, in the following code fragment, pressing tab jumps between various values, instead of actually inserting a tab-character.
Math::Vector triangleVertices [3] = { Math::Vector(-0.5f, -0.5f, 0.0f),
Math::Vector(0.5f, -0.5f, 0.0f),
Math::Vector(0.0f, 0.5, 0.0f)};
Does anyone know what might be causing this behaviour, or what settings I need to adjust to stop this?
The about tab shows the following build/versions:
CLion 2017.2.1
Build #CL-172.3544.40, built on August 2, 2017
Edit: Grammar
By default the tab key is key-mapped for indentation along with switching to next parameter, which it is supposed to determine intelligently.
You can disable/change this behaviour by navigating to Preferences > Keymap > Next Parameter.
Regarding spaces, goto Preferences > Editor > Code Style > {Language} > Tabs and Indents and choose what suits you best.
Related
Is there a way, either built-in or by third-party extension, to disable triple-click from selecting the entire line while in a text editor? Either my mouse is too sensitive, or I'm inadvertently doing it, but more often than not, clicking a word, then copy / pasting it results in pasting of the entire line -- not my intention and very annoying. Ideally, it could be disabled (aka any click more than 1 just selects the word the cursor is over)
As already stated in the comments the problem is most likely that the word highlighting color is so similar to the color of selected text. So seems like we sometimes deselect a word instead of selecting it. And without a selection Ctrl-C copies the whole line. I had the same issue with JetBrains WebStorm. In Visual Studio for me it was ReSharper.
Changing the color helps. Tools -> Options -> Environment -> Fonts and Colors -> "ReSharper Usage of element under cursor". I made that darker such that selected text is clearly distinguishable.
In the VSCode editor when you pull the scroll bar down to the bottom of the file, all you see is a blank page, since the text has scrolled up past the top of the text editor window. This makes scrolling to the bottom difficult because you can't just pull the scroll bar quickly all the way down but have to carefully position the cursor so you can still see your code.
Very similar to How to make Visual Studio editor stop scrolling past bottom of a file?, but comments have pointed out that question/answer is for Visual Studio. This answer is for VSCode on the macOS and Windows.
The correct answer is seen here: https://stackoverflow.com/a/40588828/1189470
There is a configuration option provided in VSCode for the functionality you specified. To enable it, go to File -> Preferences -> user settings
On the right side of the editor in settings.json paste the below line at the bottom (before closing bracket), save and close.
"editor.scrollBeyondLastLine": false
This will prevent the editor from scrolling beyond the last line.
This is now exposed as a simple checkbox labeled "Editor: Scroll Beyond Last Line" in File/Apple -> Preferences.
If just for readability you would like some space at the bottom of the file - a configurable amount - try this setting as of v1.43:
editor.padding.bottom in pixels
Editor> Padding: Bottom
Controls the amount of space between the bottom edge of the editor and
the last line.
and/or
editor.padding.top // but this isn't sticky in the sense that you can scroll right past the padding top and it is gone. It doesn't stay.
I have a blue box and a green line next to line numbers in studio. What are these and how can I get rid of them?
Blue box on the left is a bookmark. To toggle (turn on and off) a bookmark, place a cursor on the line and press Ctrl+F2 (or in menu Edit > Bookmarks > Toggle Bookmark). Bookmarks are useful tool. With F2 you can quickly jump to the next one.
Green bar (also yellow, and also orange in VS2010) is visual indicator that that line has been changed. More info here. The feature is useful, and you get used to it after a while, and think nothing of it. If you want to disable this feature go to menu Tools > Options > Text Editor > General and uncheck "Track changes".
Where my arrow is pointing I have seen various people who have changed the color of the highlight to blue or cyan or some other color that is easier to see and "pops out" more. I have tried searching on stack overflow and the internet and have been unsuccessful at finding how to change this specific thing rather than changing the entire color of all highlighting text. Basically when you click next to an end brace or beginning it highlights the other one but in my case its grey and I would like it to be blue or something better. How do I do this? Sorry I don't have enough reputation to post the image in this specific post.
I looked through Tools > Options > Fonts and Colors for nearly every option and changed lots of things around, but nothing changed the way it highlights those braces when you click next to one. I was able to successfully change the color it highlights it but the second I release my mouse it changes back to grey.
Tools > Options > Environment > Fonts and Colors
Resharper Brace Outline
Resharper Matched Brace Items
To change whether to display color or outline, go to Resharper Options:
Resharper > Environment > Editor > Highlight with [x] color [ ] outline
ReSharper Help/Highlighting Matching Delimiters
In Eclipse, there are two distinct features: one to format a selection, one to just indent the lines, see e.g. Difference between Ctrl+Shift+F and Ctrl+I in Eclipse. I found the format feature in Visual Studio but how can I actually just indent the lines? Is there some built-in command for that or possibly a 3rd party add-on?
Note: I have asked a couple of friend that use VS daily and they all tried to persuade me that I am looking for the format feature. No I'm not. I tried to live with it for a while and it is just a different feature. I am after the indent/reindent only.
EDIT: I am looking for a clever indent, sometimes called reindent, which is different to just pressing Tab or Shift+Tab (increase/decrease indent level). The indent feature in Eclipse behaves like this:
It places a beginning of current line at the right position, no matter where that line was starting before. So instead of thinking whether you need to increase or descrease the indent level (Tab or Shift+Tab), you just invoke the indent command and it will do the right thing.
Invoking the indent command on an empty line places the caret at the right position for the user to start typing.
It never influences any character beyond the first non-whitespace character.
If you just want to indent some lines, you can
Select them.
Press Tab.
To un-indent them, replace the second step to: Shift+Tab.
You can find more VS shortcuts here.
There are toolbar buttons for this, with wonderfully inconsistent labels (at least in the Visual Studio 2013 I'm using)...
In the "Text Editor" toolbar (in my default setup), I have to buttons whose tooltips are:
"Decrease Line Indent"
"Increase Line Indent"
In the "Customize" dialog, on the "Commands" tab (with "Toolbar" set to "Text Editor") they appear in the list as:
"Line Unindent"
"Line Indent"
And finally, if you press the "Add Command..." button (on the "Customize" dialog) to produce the "Add Command" dialog and select the "Edit" category, you'll see these two entries:
"Outdent"
"Indent"
As far as I can tell, these are all the same two commands, which should do what you want.
They also appear in the Edit -> Advanced menu, at the very bottom.
----- Edit -----
I believe you might be able to turn off all of the "formatting" actions except for indentation, so that when you use the "auto-format" command, only the indentation is "formatted" for you. (Of course this prevents you from ever using the rest of the formatting features without turning them on again, but if you don't use them, this might work!)