How to open file with double click in Visual Studio? - visual-studio

By default if you navigate in Solution Explorer and just point on some file Visual Studio immediately open this file for editing. I would like to change this behavior and open files with double click
Like written here (but it for VS Code)
https://stackoverflow.com/a/57233522/5709159
How to change this settings?

In "Solution Explorer", click on "Preview Selected Items".

Related

Is there a way to set a keyboard shortcut to open containing folder of a selected file in Solution Explorer in Visual Studio?

When I click on a C++ project in Visual Studio, I get this menu:
And so I can quickly press Alt+F,F(Command ProjectandSolutionContextMenus.Project.OpenFolderinFileExplorer) to open the folder of the project.
I also found that I can open containing folder if I open the file in the Text Editor in Visual Studio:
I bound it to Alt+F,F as well. I set it to only be active in Text Editor, it's the File.OpenContainingFolder command.
But when I click on files inside the project in the Solution Explorer, there is no context menu:
I tried to make the File.OpenContainingFolder command global, but it still doesn't work in the Solution Explorer when I just click on a file once. If I double click it and open it in the text editor, it works.
And I can't find a command in the Keyboard section in options of Visual Studio to open containing folder of a file selected in the Solution Explorer.
Maybe someone knows how to do it?
You can create an external tool menu item, and then bind a shortcut to that item.
Go to Tools > External Tools.
Click Add.
In Title edit box type Show in Explorer.
In Command edit box type explorer.exe.
In Arguments edit box type /select, $(ItemPath). There is a space between a comma and a dollar sign.
Click OK.
Make note at the position of the new command in the list. It could be first, it could be fifth, or something else. Let's assume it's the fifth one.
Assign a shortcut to the command Tools.ExternalCommand5. Restrict the shortcut to Solution Explorer.
That's it.

Visual Studio Solution Explorer, selected file changes when I click into Main Coding View [duplicate]

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?
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:
Option 1: Using icon in Solution Explorer
You can enable or disable the feature in Solution Explorer using the "Preview Selected Items" button.
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.
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.
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"
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
It's no longer there in VS2019. You enable/disable it through "preview selected Items" in Solution Explorer.

How can I make Visual Studio open .linq files in LinqPad.exe rather than it's own editor

I have a VS 2017 solution that contains some .LINQ scripts. When I double click those files in the solution explorer in VS I'd love to have them open in LinqPad (the default system editor) rather than a VS text editor.
Is there a way to configure VS to do this? I tried Tools->Options->Text Editor->File Extensions but none of the options there seemed like it would open something outside VS.
I realise this is an old question and I don't have VS2017 but just in case it is applicable, VS2019 provides this functionality. If you right-click on the .linq file in Solution Explorer and choose "Open With..." you will be presented with a dialog similar to below:
LinqPad may not be in the list. If it's not then click "Add..." and navigate to where it is installed and choose the LINQPad.exe executable.
Make sure to click "Set as Default" and then click OK.
Opening the file from Solution Explorer should now open it in LinqPad rather than Visual Studio.

Is there a way to open a file from solution explorer when drag and drop in code editor. VS 2010/2012

I really would like to be able to open files while dragging and dropping it from "Solution Explorer" to Code Editor(main) Window in visual studio.
Is there a way to do that ? Can't believe Microsoft didn't think of that !
Visual Studio instead of opening the file creates a link to that file using its path. This is useless knowing that I can do the same just copy pasting the file into the Code editor.
It is possible though to open the files directly while dragging from Windows Explorer to Code Editor Window. I want the same with "Solution Explorer" !!!

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?
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:
Option 1: Using icon in Solution Explorer
You can enable or disable the feature in Solution Explorer using the "Preview Selected Items" button.
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.
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.
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"
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
It's no longer there in VS2019. You enable/disable it through "preview selected Items" in Solution Explorer.

Resources