VSCode: How do I disable vscode from scrolling to where I click? - visual-studio-code

I can't find out how to disable this feature. VSCode will scroll to wherever I click in the text editor. It ends up scrolling the text as I press down to click and text gets highlighted until I release the click. This is very annoying. I have to click very very lightly in order to prevent this from happening. How do I disable this scroll-to-click feature.

I found the feature that allows the behavior to happen. It is called "Cursor Surrounding Lines".
Editor: Cursor Surrounding Lines
Controls the minimal number of visible leading and trailing lines surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.
The value was set to 200, so I just set it to 0. Fixed the issue.

Related

Prevent VSCode from scrolling up or down when selecting text

When I use VSCode and select text with a mouse (instead of the trackpad) the view is moving up and down slightly. It is annoying. Usually, it only scrolls when the selection is going off screen. Is there a way to turn this off?
It also moves when I place the cursor on new lines.
Editor settings:

Access mouse over hover in VSCode

Is there a way to access the mouse over popup in VSCode via Keyboard and navigate in it?
I often use the mouse over to get the namespace of function or variable ...
So I want to place the cursor on "bar", popup the hover (Show Hover Ctrl+k Ctrl+i), focus it, mark some text (eg. namespace::functioname), copy and close the hover.
namespace foo{
void bar();
}
First problem, the hover doesn't get the focus and I don't know how to focus it. But there is another feature "Show defintion preview hover", which actually gets focused. So far so good. But I still cannot mark or copy text inside the hover via keyboard.
Show hover (not focused):
Show definition preview hover (focused):
But I still cannot mark or copy text inside the hover via keyboard.
That should change with VSCode 1.68 (May 2022):
Lock hovers to more easily mouse over them
Some custom hovers cannot be moused over and others are tricky to mouse over without hiding it because of other things in the way (eg. like a scroll bar).
Holding alt while a hover is active will now "lock" it, giving it a wider border and preventing moving the mouse outside of the hover widget or whatever triggered it from hiding it.
This is primarily an accessibility feature to make hovers play nice with screen magnifiers but it is also useful for copying text from certain hovers.
Note that this feature only applies outside of the editor because editor hovers can always be moused over unless specified otherwise via a setting.
This will be helpful for other views (debug, terminal, ...) where variables with their popup can appear as well.
In the editor, see microsoft/vscode issue 63296
ctrl+K ctrl+I to show the hover and focus it
ctrl+A to select all the hover content
ctrl+C to copy to clipboard
It does indeed work for me (on windows) for the first two steps, however ctrl+C does not copy the text selected with ctrl+A.
It seems like there are two different selections possible in the hover:
ctrl+Aselects everything with a dark blue.
When selecting some text in the hover with the mouse (i.e. press the left mouse button while near/over a char, move mouse, release left mouse button) the selected text is shown in a lighter and brighter blue.
The two selections can coexist.
ctrl+C always copies the text selected with the mouse, or nothing if there's no such selection, no matter whether a ctrl+A selection also has been done.
If there's only a ctrl+A selection, ctrl+C doesn't copy anything.
The two selections can be selected in any order. The order doesn't change the behavior.
Think I found out what you were after.
The shortcut is: Ctrl+K Ctrl+I
See: Trigger advanced hover information with keyboard
please try control + mouse click
it may be help you

Get rid of black blinking cursor [duplicate]

When I edit code in the middle of statements, it replaces the current code around it. I cannot find a way to replace this with a normal cursor that only inserts data instead of replacing it. Is that functionality possible in Eclipse?
The problem is also identified in your status bar at the bottom:
You are in overwrite mode instead of insert mode.
The “Insert” key toggles between insert and overwrite modes.
It sounds like you hit the "Insert" key .. in most applications this results in a fat (solid rectangle) cursor being displayed, as your screenshot suggests. This indicates that you are in overwrite mode rather than the default insert mode.
Just hit the "insert" key on your keyboard once more... it's usually near the 'delete' (not backspace), scroll lock and 'Print Screen' (often above the cursor keys in a full size keyboard.)
This will switch back to insert mode and turn your cursor into a vertical line rather than a rectangle.
You might have pressed 0 (also used for insert, shortcut INS) key, which is on the right side of your right scroll button. To solve the problem, just press it again or double click on 'overwrite'.
This problem, in my case, wasn't related to the Insert key. It was related to Vrapper being enabled and editing like Vim, without my knowledge.
I just toggled the Vrapper Icon in Eclipse top bar of menus and then pressed the Insert Key and the problem was solved.
Hopefully this answer will help someone in the future.
In my case, it's related to the Toggle Vrapper Icon in the Eclipse.
If you are getting the bold black cursor, then the icon must be enabled. So, click on the Toggle Vrapper Icon to disable. It's located in the Eclipse's Toolbar. Please see the attached image for the clarity.
This issue can happen not only in eclipse but also in any of the text-editor.
On windows systems, windows-10 in my case, this issue arose when the shift and insert key was pressed in tandem unintentionally which takes the user to the overwrite mode.
To get back to insert mode you need to press shift and insert in tandem again.

How do I turn on text wrapping by default in VS Code

Usually when I use VS Code, very first thing I do on new document is command: "Toggle Word Wrap" or Alt+Z. I tried looking into User Settings, but I didn't find any relevant entries. Is there some way to have text wrapping 'on' for every document by default?
The setting is now "editor.wordWrap": "on", which should be set to "on" (the default value is "off").
Switching to "on" activates word wrap on all documents in Visual Studio Code.
See the release notes about Word Wrap changes for more info.
Version 1.32.3
If you don't want to edit any files you can just turn it on under user settings:
Code > Preferences > Settings > Text Editor
Type "wordwrap" in the search or scroll to bottom of the list just before the cursor section. You'll see it as "Word Wrap / Controls how lines should wrap."
Have a look at the setting editor.wrappingColumn (see the docs for more information)
Update 2017-04-06:
Recently the setting changed (see here) to editor.wordWrap with several options:
We therefore decided to deprecate editor.wrappingColumn (with its -1,
0, >0 cases) in favor of editor.wordWrap.
Here are the new word wrap options:
editor.wordWrap: "off" - Lines will never wrap.
editor.wordWrap: "on" - Lines will wrap at viewport width.
editor.wordWrap: "wordWrapColumn" - Lines will wrap at the value of editor.wordWrapColumn.
editor.wordWrap: "bounded" - Lines will wrap at the minimum of viewport width and the value of editor.wordWrapColumn.
In 2020, here are simple steps to do it.
Click on 'File' on the top menu.
Click on 'Preferences' --> 'Settings'.
Scroll a little bit until you find 'Editor: Word Wrap'.
Click on the dropdown menu and choose 'on'.
Done. Settings will be saved by default.
Hope this helps.
So easy. This solution worked for me.
Click on 'File' on the top menu.
Click on 'Preferences' --> 'Settings'.
Search Word Wrap in the search box then you will see Editor: Word Wrap.
Click on the dropdown menu and choose 'on'.
It will definitely work.
Thank You.
Firstly go to the setting-> the search on search box word wrap-> then on the word wrap option.
Open User Settings Json and add ( As shown in the image below)
"editor.wordWrap": "on",
Press ctrl + , from the keyboard.
This will take you to the settings tab.
Type word wrap in the search tab.
Click on Editor: Word Wrap drop down.
Select on.
You are done.
See the image and follow the red boxes.
caw5v's answer mentions that word wrapping would not work if accessibility is on.
But that will change with VSCode 1.73 (Oct. 2022):
We disable word wrap when accessibility is turned on.
I would remove this limitation due to three reasons
User feedback
Now the status bar is accessible and Ctrl + g announces line number so it is much easier to figure out what line you are on
WordWrap is off by default if the user turns it on he or she should be aware of it
This is now the new policy available today in VSCode Insiders:
If you activate Word Wrap, it will be active even if Accessibility mode is on.
For those still having issues, make sure to check if 'Accessibility Support' is on. While "on" word wrapping can be disabled if a screen reader is detected.
settings > user&workspace > accessibility support
This worked for me. I run two additional monitors, however, I use an m1 macbookpro so support for two monitors is not available. To solve this I use a displaylink connection. Vscode appears to identify my displaylink connection as an accessibility screen reader.

How can I scroll left and right in Eclipse editor with the keyboard without moving the cursor?

To scroll within the Eclipse editor without moving the cursor up and down one can use CTRL+Down or CTRL+Up. But what about left and right?
It is not possible. If you search keys in Eclipse's Preferences, you will find out that you only have Scroll up and Scroll down that you can set hotkeys on.
My recommendation would be changing the maximum line length in the editor.
Make your code shorter. After all, looooong lines of code are not so readable.
Also, resize your editor area. If you feel strangled, remove the Outline, TaskList, and Build view from your right side of Eclipse, and enlarge the editor.