ChatGPT解决这个技术问题 Extra ChatGPT

How to stop Visual Studio from opening a file on single click?

In my Visual Studio 2012 Solution Explorer, when I single click a filename it opens it. This was different from Visual Studio 2010 (required a double click). Is there a way to make double-click the 'view file' command?

What do you expect it to do after you click (single) on the file name? Nothing? BTW, you can change this behavior in "Environment"-"Tabs and windows". But you should'n, in my opinion ;-)
On a single click I expect it to be selected, so I can check its properties

T
TylerH

This is called the Preview Tab feature. To change that behavior, go to:

Tools -> Options -> Environment -> Tabs and Windows

Then look for the "Preview Tab" section, and uncheck the options therein:

https://i.stack.imgur.com/iboRQ.jpg


It's also an option on the solution explorer itself, one of the buttons at the top toggles it.
Just wanted to add that the button David is referring to has a tooltip: "Preview Selected Items"
As the image above shows, you can alt-click a file to avoid the preview tab if you're just clicking it without wanting to see it for whatever reason.
Just wanted to add that the "Preview Selected Items"-button David is referring to is at the far right ;-)
Just wanted to add that button at the far right Rango is referring to looks like a folder with magnifying glass at the bottom left corner ;-) (in VS 2012, at least)
V
Vinicius Rocha

Option 1: Using icon in Solution Explorer

You can enable or disable the feature in Solution Explorer using the "Preview Selected Items" button.

https://i.stack.imgur.com/9jISz.png

The icon is a Tab aligned to the right.

Option 2: Using the Options window

You can enable or disable the feature by going into Tools > Options and then Environment > Tabs and Windows.

https://i.stack.imgur.com/V3Y3v.png


L
Lmn

The Single-click opens files in the preview tab text mentioned in rubber boots' answer is missing in VS 2015. Mysteriously, a search for "single click" still brings up the Environment > Tabs and Windows option.

So for VS2015 and VS2017, either click the button in Vinicius's answer, or uncheck the Preview selected files in Solution Explorer box shown in the screenshot below.

https://i.stack.imgur.com/5vh8L.png


A
Anwar Ul-Haq

In Visual studio 12/13, easiest way is to type "single click" in quick search and than select Tabs and Windows.

And in Tabs and Windows dialogue ,uncheck "Preview selected files in solutions explorer"

https://i.stack.imgur.com/OPIfh.png

https://i.stack.imgur.com/wTa6g.png


That's some beautiful highlighting
J
Josip Ivic

Shortcut Ctrl+Alt+Home.

If you press that in a document that was just opened, it will be opened permanently.

Item -> right click -> Open With -> Source Code (Text) Editor -> press Set as Default button


P
Pang

It's no longer there in VS2019. You enable/disable it through "preview selected Items" in Solution Explorer.

https://i.stack.imgur.com/ZUZKC.png