Go to definition in new tab without changing the view - visual-studio

When I do command + click on visual studio or right click and "go to definition", the file containing the definition opens in a new tab and I automatically see this file. So I change the view if the file containing the definition is another file.
Is it possible when I do this command to stay on the same file I was while still opening the other file in another tab?
Thank you for you answer.

Preferences >> Settings >> Workbench >> Editor >> Enable Preview >> Uncheck/false

If you're capable to actually go to the definition you are looking for what is called the "Peek Definition". VS Code is highly customizable so how you have it configured it could do something different.
What I think you're looking for is Ctrl + Left Mouse Click or Alt + F12.
This should tell you more, VS Code Peek Definition

Double clicking on the tab name also works if you don't want to disable preview feature of editor. Double clicked tab becomes persistent.

You can also peek definition with Alt + F12 (be sure to highlight its symbol / invocation first).
This opens the definition in a smaller resizable tab (resizable down to ~4 lines of code) and allows editing if needed.
Example (source):

Taken from:
https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition
If a language supports it, you can go to the definition of a symbol by pressing F12.
If you press Ctrl and hover over a symbol, a preview of the declaration will appear.
Tip: You can jump to the definition with Ctrl+Click or open the definition to the side >with Ctrl+Alt+Click.

Related

Auto-indent after pressing `Enter` between tags

Please see the GIF below:
I am using Visual Studio Code. By pressing Enter and Ctrl + Shift + Enter. I can make the auto indent in the next line.
So, I guess there is a more convenient way or package which can accomplish that by just pressing Enter.
In preference->editor search for autoIndent and make it full
I resolved this problem by switching Language Mode from Django HTML (for some reason it was auto detected) to HTML.
Press Ctrl+Shift+P (or directly press Ctrl+K, M => Select HTML)
Print 'Change language mode' and press Enter
Select HTML
I'm not sure if you are still having this problem, but I stumbled across this other post that seems to have a solution:
Visual Studio Code Auto close tag and indent XML as with HTML
Hopefully this is what you're looking for.
EDIT: I've just realised that this causes the language mode to be changed to HTML, which may lead to unexpected/unwanted behaviour. It suits my needs, however.
I have modified the Emmet preferences, I'm not sure if it's a good solution, but it works.
In the preferences, search emmet.includeLanguages
Click Edit in settings json
In the right column, click on User settings
Add "emmet.includeLanguages": {"php": "html"} on the last line

Navigate to open files / open tabs

Problem: Some times I have many tabs open and finding a tab is not easy and fast.
Question: Is there any shortcut in visual studio or resharper that allow us to find a tab by typing part of file/tab name?
Example: Something like Navigate-> Recent files... of resharper:
Looking up the ReSharper 2017.2 Help - Navigation and Search I could not find any hint about navigating through active files.
Visual Studio allows you to navigate through all open tabs by using Ctrl + Tab. This allows you to switch trough all open tabs ordered by their latest use. Use Ctrl + Tab again for forward and Ctrl + Shift + Tab for backward navigation. But as you already mentioned with a lots of open tabs it could be slow stepping through all active files.
What I personally do in your situation, when trying to find a open tab or any kind of class/file/member, is to use the Ctrl + T shortcut. This opens the Go to Everything/Type … popup, which allows you to search for anything within you solution.
To find an item in your solution by the item's name
To use the unified access to all search results, press Ctrl+T to display a pop-up where you can start typing and find everything in your solution that matches your input.
If you want to limit your search to types (classes, interfaces, structs or enums), press Ctrl+T twice.
If you want to find anything by a plain textual match, press Ctrl+T three times.
If you want to search symbols (types, methods, properties, fields, and so on) - press Shift+Alt+T.
You can also limit the search to files in your solution by pressing Ctrl+Shift+T.
from ReSharper Help - Navigation by Name
More Shortcuts: Resharper - Default Keyboard Shortcut Schemes
Yoy can try set shortcut to open window with active tabs: Options -> KeyBoard -> Window.Windows
It will look something like this

Rearrange Code shortcut in Resharper doesn't work in VS2015

When I try to use the shortcut for moving lines up/down (Ctrl+Alt+Shift+↑/↓), it highlights the code and shows the tooltip message "Use Up/Down to move text line" but nothing happens. If however I try the same command via the menu bar (Resharper > Edit > Rearrange Code > Move Up) it moves the selected lines as expected.
I used to use this feature all the time so I find this bug very annoying. Apparantly, others also experience this (see comments for Resharper move line up down not working) but I haven't been able to find a solution for it. Resetting keyboard layouts and reapplying VS keyboard schemes doesn't work.
Has anyone been able to resolve this issue?
[EDIT]
Reason of this is issue (when you are logging to machine with VS and Resharper via Remote Desktop) is that Ctrl-Alt-Left Arrow/Ctrl-Alt-Right Arrow combinations are not sent to your virtual machine
There are two workarounds:
My first soultion (change combination see below)
You can use AutoHotKey script as stated in thread:
https://superuser.com/questions/327866/remote-desktop-sending-ctrl-alt-left-arrow-ctrl-alt-right-arrow-to-the-remote-p
[/EDIT]
Reason is
duplication of the same hotkeys which could be found in 'Shortcut currently used by:' combobox
Fix is
I described process for _MoveRight shortcut - for other shortcuts it works the same
STEP 1 Check for conflicting changes
seeImage
go to Tool --> Options --> Keyboard
in field 'Show commands containing' find your command (moveright in example)
click in field 'Press shortcut keys' press ALT + RIGHT ARROW
in field Shortcut currently used by you will find conflicting shortcut -
Edit.CompleteWord...
STEP 2 Now we need to delete this shortcut
in field 'Show commands containing' write Edit.CompleteWord
you should see ALT + RIGHT ARROW shortcut in field 'Shortcuts for selected command
click Remove button
STEP 3 Now we need to add our shortcut to _MoveRight function
in field 'Show commands containing' find your command (moveright in example)
click in field 'Press shortcut keys' press ALT + RIGHT ARROW
click Assign

Hot key to pop open rename options?

When Visual Studio, when you rename a variable or type the name of a class that hasn't been included, a little box appears under the text. If you hover your mouse over it, it pops open and gives you options to either rename all the variables, or include the missing reference.
I'm sure there's a hotkey to pop this open so I don't have to use the mouse. What is it?
Press Ctrl+. to open that menu.
For me it's Shift+Alt+F10. Depending on the VS version and your keyboard settings it might be different for you.
The actual shortcut is shown in the tooltip when you check the "Show shortcut key in ScreenTips" box at the bottom of the Tools\Customize\Toolbars dialog (VS2009). This is among the first things I turn on when installing VS.
Use Shift + Alt + F10 to bring up the Resolve menu when your cursor is on the unresolved item.

Shortcut key for 'View in Object Browser'

Does anyone know if there is a shortcut key for viewing the selected object (in the text editor) in the object browser?
I am sure there was one, but I cannot find it, or anything that seems to work in the key bindings dialog.
eg:
string test = string.empty;
if (string.isnullorempty(test))
{ ^ caret here
...
}
pressing the key would open the object browser to System.String
This navigates to the correct class inside the object browser.
Shift+Alt+F12, then right click in the results and select Browse Definition
or
Ctrl+Alt+J, then type the name in the search box
F12 will go to the source (if you have it), or the object browser if it's in a referenced assembly.
Use Ctrl-Alt-J.
Yes, this is CTRL + ALT + J
Here is the reference: Object Browser Shortcut Keys, Visual C++ 6.0 Default Shortcut Option
The only way I found doing it with a single shortcut is through ReSharper and define.
Editor context menu. codewindow.navigate.resharper_navigatetoobjectbrowser
as alt +shift + j (or what you want). Maybe there is a way to create a code, link it to the functions and add the shortcut in this window without installing ReSharper, or open a ticket to visual studio teem
the shortcut
It used to be Ctrl + LeftMouseClick on what you want to search for (around 2015), but it does not work anymore in VS 2019.
Resharper navigates to the class in object browser when you press F12

Resources