VS Code - Hide file path in debug console - debugging

In VS Code's debug console, how can I hide the long file path at the right of every line?

As a temporary solution you can disable "words wrap" in
console settings.
This adds horizontal scrollbar in debugger console.

See the issue https://github.com/microsoft/vscode/issues/115625 (Hide or shorten path in Debug Console) which has been implemented and is in the Insiders' Build v1.54.
It shortens the file but does not hide it. In my testing this
c:\Users\Mark\AppData\Local\Programs\Microsoft VS Code\resources\app\out\bootstrap-fork.js
was shortened to
...Code Insiders\resources\app\out\bootstrap-fork.js:5
It doesn't appear to be configurable in any way but is a welcome improvement IMO.
Following up on #rioV8's suggestion here is the themeable reference to those source file paths:
"workbench.colorCustomizations": {
"debugConsole.sourceForeground": "#0000"
}
The last digit of that hex color is opacity. Even if you set the opacity to 0, you can still hover and see the file name and click on it as if it was shown.
But switching off the opacity will have no effect on where your debug values break or wrap into the next line. That wrap still operates as if the source file name was fully visible - which may have been your biggest concern.

Related

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

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.

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 highlighting space / horizontal line between parentheses

I would like to show a vertical line, next to the linenumbers, in my visual studio 2010 between parentheses when my courser is between those 2 parantheses.
I alread had that option enabled, but somehow its gone.
edit: is nobody using that feature? one of the very nice things when you are debugging
Is no one using that feature??
Edit: so last push!! there must be a way to see where the space between parentheses starts and ends.
edit: here is an image
EDIT: I still haven't found what i'm looking for. VS is so powerful there must somewhere an option or a plugin. It is really useful when you can see where your { begins and ends }.
Anyone a clue?
I haven't seen the horizontal line feature since 2008. I hated it so I haven't been looking for it either.
You should however be able to see the braces being highlighted when your cursor is on them. If not, perhaps you've changed your theme or possibly some colors in your Options menu.
Here's what you should try:
Tools ->
Options(down at the bottom of the drop-down) ->
Environment ->
Fonts and Colors
Make sure the Show settings for: selector is showing Text Editor.
The one(s) you're looking for are Brace Matching (Highlight/Rectangle).
Attempt to change it to your choosing and see if the changes take place. If not, reset to the defaults and re-check it's enabled.
Also...
Another suggestion that can be handy to get a temporary look at the extents of the body you can hover your mouse just along the margin it will highlight the most nested body. You may have to do some tweaking of your colors to make it vibrant. I use a darker color and have my code block highlighting white. I know it's not what you're looking for but it might be somewhat of a band aid.

What does the scalpel-shaped icon in the gutter in Visual Studio 2008 mean?

What does this icon mean?
It doesn’t seem to have a tooltip, it doesn’t respond on right-click, and it doesn’t seem to want to disappear either.
It shows Find All results. (Possibly other things too!)
Edit to clarify: when you double-click an entry in a Find Results panel, the "scalpel" shows up next to the relevant line of code. Helps you pick it out by eye, I guess, as the cursor may not be very noticeable.
Further edit: this page says To jump to a match, double-click any line in the results list. The source file is displayed in the Code Editor with the insertion point placed where the matched text begins. A symbol appears in the indicator margin of the Editor to mark the line that includes the match, and the status bar displays its full text. - as they don't name it I doubt the symbol is used elsewhere.

Visual Studio 2008 Debug Window to display timestamp?

I want to be able to see a time stamp in the beginning of every trace in the debug window in Visual studio.
[Time stamp here] The thread 'Win32 Thread' (0xcd0) has exited with code 0 (0x0).
[Time stamp here] => CLR ProvideAssembly: AppDomainId: 1, Ref: 'msvcm90d...
Example of this is the sysinternals application - DebugView. The problem is that I can't have Visual Studio debugging, and listening with DebugView at the same time, and I am not comfortable with adding the time stamp manually to my tracers.
Since the output window text is read-only once written, there's not an easy way to do exactly what you want to do. However, it's easy to do something similar: append a timestamp line after new text is written to the output window. This will make the output window a lot more messy, but you'll get your timings.
Here's how this would work: First, create a Visual Studio Add-in or Macro which hooks the PaneUpdated event of the Outlook Window's active pane. (See this thread for how to do this with a Macro approach). Make sure to check, in the event handler, that pane.Name == "Debug" and ignore other panes. Second, when you detect new text in the debug output pane, append a timestamp line, like this:
public void AddTimestamp(DTE2 dte)
{
// Retrieve and show the Output window.
OutputWindow outWin = dte.ToolWindows.OutputWindow;
pane = outWin.OutputWindowPanes.Item("Debug");
}
catch
{
pane = outWin.OutputWindowPanes.Add("Debug");
}
pane.OutputString("[timestamp: " + DateTime.Now.ToString() + "]\n");
}
It's also possible to pre-pend a timestamp to each line, but it's a lot harder. You can't change text already in the Output window (it's read-only), but you can clear the window and you can add text. So you could use the same event-handler approach above to detect text changes, but instead of appending you could copy the current text, prepend timestamps to any lines which don't have timestamps already, clear the window, and re-add the now-with-timestamps text. The problem with this is performance once your output window gets large. So you'd probably have to implement a kind of "lazy stamping" which does the clear and insert in the background, in order to avoid killing your IDE when (as is common) 100's of lines of debug output get emitted in a short time. Also, when you clear and re-add, if you're currently selecting text in the output window, your selection is lost.
Personally, I'd just do the easy thing and append timestamp lines rather than the harder pre-pend approach. Since stuff at the end of the line is hard to see without scrolling, I'd probably ensure there was a newline before the timestamp, so the user would see each batch of one or more output lines followed by one timestamp line.
It's possible there may be a way to hook the output window before text is displayed, but I couldn't find any such extensibility point in the VS Extensibility APIs.
One more idea: you could always roll your own tool window, e.g. "Ivan's Debug Output" which listens to events coming from the real output window, and echoes new lines (with timestamps) to your own tool window. This is probably the hardest option, but should do exactly what you want.
to add a new answer to an ANCIENT question, there's an feature in the productivity power tools 2013 extension and productivity power tools 2015 extension that add a timestamp margin to the output window, no code required.
I was looking for the same functionality. Colleague of mine came up with the $TICK macro in the message field, printing out the 'current' cpu ticks.
Take a look at these tips from Simon Chapman, too.
I wanted this functionality too, so eventually I wrote an extension to do it (much like Justin Grant suggested in the accepted answer). After using it for a while, I decided that relative timestamps were even more useful to me when debugging. If folks wanted absolute timestamps, I'm sure I could add that functionality back in. Anyway, if you're interested you can check it out at niahtextfilter.com.
And to show the relative timestamps in action in a Visual Studio debug session:

Resources