Visual studio - select word with hyphen - visual-studio

When you ctrl+click or double click a word in the Visual Studio text editor, it stops the selection at a hyphen. So, for example, you cannot select a full GUID with ctrl+click. Is there a way to remove the hyphen as a word separator?

There is an extension that solves this issue for visual studio. "Select Hyphenated" # marketplace.visualstudio.com
There is also a setting in vscode:
"editor.wordSeparators": "`~!##$%^&*()-=+[{]}\\|;:'\",.<>/?",
By removing the hyphen, double clicking selects whole hyphenated words.
I also removed the period and hash for selecting css classes and ids.

Related

Ctrl+Click on a quote to select everything in quote in Visual Studio [duplicate]

Is there a keyboard shortcut (or customizable keyboard shortcut) to select text inside a single quote '' and double quotes "" in Visual Studio 2012.
eg:
string name = "John Doe";
instead of dragging the mouse to select all of John Doe, is there a way to just point the cursor inside the double quotes and
press a key combination to select it? Wanting to avoid usage of mouse a much a possible.
I found a similar question
Visual Studio / R# Keyboard shortcuts: select string with or without quotes
but the shortcut given will only select a particular text, not the entire text inside quotes
TIA
In researching this I have found two answers:
Answer the first
Ctrl+Shift+W will select the text of the word that your cursor is on within a string. Press it again to select the text of the entire string without the quotes, again to select the quotes, again to select the next logical container and so on.
Answer the second
If you use ReSharper you can use Ctrl+Alt+Right Arrow to do the same thing as Ctrl+Shift+W. You can also use Ctrl+Alt+Left Arrow to reduce your selection by one logical container.
In Visual Studio 2013 it was Ctrl+Right Click. You can use Ctrl+Shift+] for Visual Studio 2015 ;)
TLDR; CTRL+W+W
I am using visual studio 2017 with ReSharper. I don't know if it is ReSharper that added the command or if it is native to VS2017 but using my set-up it is possible to select the text within quotes by putting the cursor in between the quotes and hitting CTRL+W+W
The first CTRL+W will select the word closest to the cursor. Hitting W again will select everything between the quotes.
As of VS2019, with the cursor inside the string, ALT+SHIFT+= will select the whole string, including the surrounding quotes.
I am not aware of such keyboard shortcut.
The following quick trick uses mouse and includes double quotes.
Just double click left to the first double quote, VS will select the entire string (including the enclosing double quotes).
Apparently the functionality that you're looking for doesn't exists (http://msdn.microsoft.com/en-us/library/da5kh0wa.aspx) For do that I use ctrl+shift+ arrows to select quickly but is not a visual studio functionality is global for all text editors.
regards.
In Visual Studio 2013 I was able to do this by Ctrl+Left Click on the start of the string quote (that is on the left side of the (") sign). Moving to VS 2015 this functionality no longer works for me and I would love to know how to trun it back on.
Use (Ctrl + Shift + W) in Visual studio. just move cursor before " and use this combinations of keys.

Visual studio muliline edit jump to end of individual words?

When I type SHIFT+CTRL+RIGHT, it jumps to the end of the next word and adds it to the selection.
With PyCharm, when I have multiple line selected, it will be smart and jump a different number of characters depending on the length of the word on the selected line:
However, on Visual Studio, it jumps to match the longest word in the selection. I can't imagine in what case this is useful.
Is there a way to have the jump matches the length of the word on the line, like in the first example?
I am using Visual Studio Community Version 16.4.2

Select only one character by mouse in Visual Studio 2013?

How can I enable to select only one character by mouse in Visual Studio 2013?
It's comfortable after a typo to select it by mouse, but here I must select at least two or three characters to make a selection for editing.
edit:
to be clear let's say the cursor is already far away from that typo and VS have default setting with added opencv. Still it won't select only one character, I must click, hold, move for at least three to make a selection (or more rows).
It's already enabled and you shouldn't modify anything. Visual Studio does not interfere with mouse settings and you should be able to use it just like you would with any other text editor.
I know it is annoying!
To select a single character
double click it with the left mouse.
If the character is in a word, unfortunately,
you will have to click in front of the character, then holding shift select past the character.
It's a pity you only got rude responses.
Not a very good solution but will still help your workflow if you are used to selecting a single character via the mouse :)

Convert virtual spaces into real tabs in visual studio

In Visual studio when I create a newline it sets a caret to the indent that I want. However it's not a real tab indentation until I will type any character at line. So all my empty lines are still fully empty (without '\t') and i want to make VS to convert this virtual indentation into real tabs.
I saw this question is pretty close to what I want but in differense from that I don't write an extension but search an existing solution. Though if there's no other way i will have to do it.

How can I trim trailing whitespace in Visual Studio 2012 on save?

Now that macros are gone from Visual Studio 2012, what is the best way to automatically trim trailing whitespace whenever a file is saved?
I'm aware that Format Document (Ctrl + K, Ctrl + D) will do this, but it presumably changes the file in other ways, and it's not automatic either.
The motivation is given here:
Trailing whitespace is evil. Don't commit evil into your repo
There are at least two extensions that can do this. One is CodeMaid which explicitly will trim trailing blanks on save, and the other is Productivity Power Tools which can run the Format Document automatically on save.
To add an extension from within Visual Studio 2012, select menu Tools → Extensions and Updates.... In the window, select Online on the left and enter your search string for CodeMaid or Productivity Power Tools in the box on the upper right.
Ctrl + H
Find what:
[\u0020]+\r?\n
Replace with:
\r\n
\s instead of [\u0020] delete empty line feeds, probably because it matches line feeds...
You can use Mads Kristensen's Trailing Whitespace Visualizer. It has a keyboard shortcut to remove trailing whitespace from the current file. Ctrl + K, Ctrl + \
Note: this doesn't run on save. You have to explicitly run the command. On the bright side, it visually highlights the offending whitespace, so it's easier to identify cleanup opportunities even in code you haven't modified.
EditorConfig has an option for removing trailing whitespace, and it has a Visual Studio extension. You'll need to add trim_trailing_whitespace = true to your .editorconfig to make it work.

Resources