How to make VSCode editor stop scrolling past bottom of a file? - windows

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.

Related

How to disable horizontal scroll in visual studio code?

When I scroll with the touch pad with two fingers in Visual Studio Code, I often scroll to the sides a little by accident. This is a bit annoying.
I'd be happy to have it scroll only up and down.
A partially satisfying solution, is to simply press Alt + z, to have the lines wrapped, and then it doesn't scroll to the side.
You can also make wordWrap default as described here How do I turn on text wrapping by default in VS Code
If you have this problem because of Gitlens (blame lines), the solution i found is to disable gitlens.currentLine.scrollable (or set it to false in the settings json file.
Pressing alt + z to disable horizontal scrolling, works fine for a current single file. If you want permanent solution then for every file you visit? then follow:
Settings > Text Editor > Diff Editor > Word Wrap to on
Note: in case you don't know where is this Settings, just go
1. Via MENU
File > Preferences > Settings > Text Editor > Diff Editor > Word Wrap
2. Via shortcut Keys
On Windows
ctrl + , (control + comma)
On Mac - correct me if I am wrong
command + , (command + comma)
Just want to add that some plugins, like GitLens, may mess this setting up.
E.g., with GitLens, it can add git blame information inline, at the end of each line of code, showing you who is responsible for that line's current version, and when.
Unfortunately, this information will not only be to the right of the wrap column, e.g. 80, it'll also "unlock" the horizontal scrolling, even when no GitLens blame annotation is there.
I haven't found any fix for this other than disabling such features.
Just press ALT + Z -> To enable/disable the horizontal scroll
Config: MBP 2018 | Using Magic Mouse 2.
For me, I had accidentally set the 'Scroll Beyond Last Column' to 80 chars. Just resetting it to default settings is what worked for me. Hope it does for you all!
Update (6th Feb, 2021): Enabling the mini-map again causes the problem. So disabled it to get rid of the issue.
⌥ + z
the shortcut for Mac. you welcome
February 2020 (version 1.43) update adds an option called: Scroll Predominant Axis
Scrolling predominant axis
When trying to scroll vertically using a modern touchpad, it oftentimes happens that the file scrolls horizontally as well. There is now a new setting, editor.scrollPredominantAxis (which is set to true by default) which blocks "diagonal" scrolling. This forces scrolling gestures to be either vertical or horizontal (based on the highest absolute scroll delta), but never diagonal.
When enabled,it prevents any diagonal scrolling.
It guesses your scrolling to either vertical scroll or horizontal scroll.
It says by default it is enabled. If not then you can enable in Scroll Predominant Axis in settings.
Screenshot: Editor: Scroll Predominant Axis
Or in settings.json
"editor.scrollPredominantAxis": true
Use Ctrl + E, then Ctrl + W for disable horizontal scrolling.
For more details, you can refer this cite: https://developercommunity.visualstudio.com/t/disable-horizontal-scrolling-in-visual-studio-2019/612873.

What is the black flag icon in gutter of VS2013

Visual studios 2013 is showing a black flag looking icon in the left gutter of my code. It doesn't seem to have any meaning and there is nothing particularly special about that line of code. The code works fine, I just want to know why this icon is displayed and what it means.
It may be bookmark or it may be the line at which searched text is found. In this screenshot, the black mark at line 55 shows the line in which search text is found(when we search using Ctrl+Shift+F keys) and one at line 58 is bookmark.
Bookmark can be removed by holding holding Ctrl and pressing K twice. There is also option to remove it in VS menu, same icon as on the line.
Bookmarks are put on the code where we want to navigate more frequently. There is icon in VS menu shown with the arrow and bookmark icon to move forward and backward.
It could be a bookmark. See main Visual Studio menu Edit - Bookmarks.
If you are using dark theme this is a white flag. Ctrl+K, Ctrl+K removes the flag.
To elaborate on the answer given by #Imad. The icon at line 55 can be the result of a search (Ctrl+Shift+F, or Ctrl+F). You remove it by either clearing or closing the Find Results pane.
Or it might be an error indicator from the most recent compilation. These appear in the Error List pane. Fix and recompile to remove it.
Line 58 shows a bookmark. Remove it with Ctrl+K, Ctrl+K on the line in question.
When you do a Search in VS using Ctrl+shift+F -> Find all -> click on a result from the find results tab -> you can see the black pin pointing the matching line in the code.
The answer is here - Black dash / line on visual studio 2012 left margin

VS2012 Text Editor Width

Is it possible to change the width of the text editor in VS2012 - I've got a fairly wide screen and use fairly small text so I end up with a lot wasted real-estate in the middle of my screen.
I don't want to turn off word wrap - I just want the wrap to start further right on the line. If that makes sense!?
You can set this with HTML in Visual Studio 2012 but there is no global setting and it's missing in quite a few languages.
You can just put another "dummy" window next to the one you are writing in, so the actual editor window will be smaller. You can put it on the left if you want to pan the text to the right, and to the right if you want to shorten the lines.
I actually found the answer elsewhere; VS doesn't appear to provide this functionality but Resharper does. Resharper -> Options -> Code Editing -> C# -> Formatting Style -> Line Breaks and Wrapping -> Right margin (columns)
I put mine to 200 which fixed the issue
I know that this is not what you are looking for, but I believe it solves the same problem. I too have a fairly large screen and try to make use of it as optimally as possible.
I hate tabbing between code or design tabs and try to avoid that as much as possible.
VS has a feature that permits the user to create Horizontal or Vertical Tab groups and ever since I have started using it, I have found it very helpful. These options are present in the context menu by right clicking the tab or in the VS Window Menu (Menus are seen only if the tab groups feature is not active).
I have created a screenshot with Vertical Tab Groups created as shown below. In this example, I have a overview of both the designer and the code view at the same time.
We can use tab groups whenever there is a dependency such as comparing code, redesigning a module, etc. I know it takes a little time to get used to this feature but try it out and see :)

Visual Studio 2008: Change the font size of line number

Is there any way to hack visual studio so that it displays the line numbers in smaller font size like the way Notepad++ does? I'm using Consolas at size 12 and the line numbers just look so ugly.
Thanks.
Tools > Options... > Environment Fonts and Colors > Display Items > Line Numbers
You should be able to mess with fonts and sizes there.
EDIT for the people whose hands need to be held:
Follow this click path after you open Visual Studio 2008 (most likely by double-clicking on its icon):
Tools > Options... > Environment Fonts and Colors
"Tools" is in the menu bar at the top of the screen, and is most likely the fourth option from the right. Once you click on "Tools" a menu should come down, and you should click the "Options..." option, which is the very very last one. A new window will pop up with some junk on the right and some more things to click on on the left. Those things on the left determine what options you'll be setting on the right. Click the "Environment Fonts and Colors" option, which should be the second option.
Then, make sure "Show Settings For:" is set to "Text Editor". Click on "Line Numbers" in the listbox that says "Display Items". It is located underneath the "Font (bold type indicates fixed-width fonts):" dropdown box (that textbox with the arrow on the right side that when you click it, a whole bunch of options show up). It should be the 5th option in the "Display Items" box. After you do this, you can adjust your font, font size, color, whatever your little heart desires.
Once you're done, make sure to hit the "OK" button in the lower right corner of the window where you just made all your adjustments. Your new settings should be reflected!
:\
Even though Jason is correct in his directions, he even answered your question in a round about way.
all text editor font is the same
when you have changed one of the font properties.
So in short. No you can not adjust individual fonts for items in the actual text editor, though you can adjust almost everything else through the Option dialog.
Hope this helps.

More screen space in MSVS?

I am using visual studios 2008. My laptop has the max screen res of 1366x768.
What can i do to get more reading space? i was thinking of making the font smaller but it would be more helpful if i can make everything smaller (toolbar icons, text, etc)
The only improvement i done so far was remove a bunch of things under the toolbar so i have only one line. Actually for this project i remove the standard bar so i have have the solution and text directly under the menu with no toolbar. What else can i do to maximize reading space.
Tools > Options > Environment > General > Uncheck "Show status bar"
Tools > Options > Text Editor > All Languages > Uncheck "Navigation bar"
Install the "Hide Main Menu" extension available here.
Enable Auto-hide the taskbar in your Windows Taskbar properties.
That should get you at least 5-7 more lines.
Dual screens. The more pixels the better. I like 1920x1280 extended to across a matched monitor with vertically split tabs.
Probably not the answer you are looking for, but really, it HELPS A LOT.
Ok ok:
Try Lucida Console as a font - it's readable at 8pt - and fixed width!
Hit Alt+Shift+Enter to get into Full Screen mode.
Float all your "helper" windows and use Ctrl+Tab to get to them. (Click using mouse)
Pin your Windows Task Bar to the left or right of your screen to give more vertical reading space.
What I do is unpin all the various tool windows and views. Unpin the Solution Explorer, Properties viewer, Output etc. and the Toolbar. This leaves you with just the coding window and small bars around that allow you to hover over the edges of the window and see everything you just unpinned.
set the Solution explorer on the right to Auto-Hide, close the error window when possible (as in when you're not fixing errors), and try and drop the number of toolbars vertically to 1. You can also change the size of the text down by going to Tools > Options > Environment > Fonts and colors but i wouldn't shrink the text unless you have good vision. I recommend Consolas 12 Point for your code; it's a bit big but very nice looking!
I got rid of the toolbars altogether and made things like the Solution Explorer autohide. I came to the realisation that the only toolbar button I ever used was a custom tool one I'd put there (I use the menu for that now). I'm running at 1920x1200 so real estate wasnt an issue - I just wanted less visual distractions. Just me and the code.

Resources