7

Introducing a New Way to Search Your Code and Visual Studio Features

 2 years ago
source link: https://devblogs.microsoft.com/visualstudio/introducing-a-new-way-to-search-your-code-and-visual-studio-features/?WT_mc_id=DOP-MVP-4025064
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Introducing a New Way to Search Your Code and Visual Studio Features

Denizhan Y

April 20th, 2022

All developers search within their code, in one way or another. Some might use code search to explore their code and understand how some components work; others might use code search to get to a very specific location they have in mind. Either way, as a developer yourself, sometimes this process of searching and finding a location might be frustrating and take you longer than you might want. Visual Studio 17.2 Preview 3 introduces a brand-new All-In-One search experience that merges the existing VS Search (Ctrl + Q) and Go To (Ctrl + T) to allow you to search both your code and Visual Studio features quicker and easier than ever, all in the same place. The All-In-One search streamlines your searching experience by providing you with a customizable UI (size, location, and dismissibility), compact search results with real-time matching as you type, and a fully keyboard friendly interface to ideally minimize your searching pain points. To try it out, download Visual Studio 17.2 Preview 3 today!

An animated GIF showing how the new All In One search experience works overall

Search for code or Visual Studio features!

The new All-In-One search provides users with a tab for code searching where you can search for symbols in your code and a tab for Visual Studio feature searching to navigate the IDE easier.

What is symbol search?

Symbol searching is a quick and easy way to navigate your loaded code. Unlike search tools like Find-in-Files, a symbol search will not search for all text matches in your code. Instead, it will look up symbol definitions. For example, you can go to the exact location where a class, method, function, variable, etc. is defined instantly. Furthermore, your search results will not be cluttered with matches in text matches such as comments, string literals, etc.

What is Visual Studio feature search?

Visual Studio can sometimes get overwhelming with all of the tools and functionalities it provides. So much so that sometimes, you don’t even know where these tools exist, or you find yourself digging through lots of menus just to find where something is the IDE. The Feature Search tab in the All-In-One Search experience allows you search for Visual Studio menus, options, components, and templates. For example, I can easily launch the Solution Explorer or even search for Git functionalities all within this search experience. It’s now easier to achieve exactly what you want without the need to navigate through various menus!

An animated GIF demonstrating Visual Studio feature search in the new All In One search experience

How to use All-In-One Search

To enable the new preview feature, go to Tools > Options > Environment > Preview Features > New Visual Studio Search Experience. After restarting, you will now be able to open the All-In-One Search either with your mouse or through keyboard shortcuts

Entry Point

To open the All-In-One Search experience with your mouse, click the split button at the top of your IDE next to the “Help” menu item. Clicking the dropdown arrow will present you with two different search options: Code Search and Feature Search. Selecting either one of these options will open All-In-One Search in the respective tab. You can also simply click the “Search” button, which will open the most recently selected tab from the drop-down options.

Once the window is open, you can either click between the different tabs, or you can use Ctrl + Tab or the assigned keyboard shortcuts of Ctrl + T and Ctrl + Q to switch between the code search and feature search tabs.

Code searching in All-In-One Search

As we briefly explained above, the All-In-One code searching experience provides you with a symbol searching experience. In addition to symbols across your solution, you can also search for files. The three code results include:

  • Files: Search for any file type located anywhere in your loaded code in VS
  • Types: Search for definitions of classes, interfaces, enums, and types
  • Members: Search for definitions of members defined in classes and types

You can filter down your results using the files, types, and members toggle buttons in the search window:

A screenshot of Visual Studio's All-In-One search window highlighting the files, types, and members filter toggle buttons

You can access these filters without using your cursor, too. By prefixing your search query with “f:”, “t:”, or “m:”, you will be able to get the same behavior as selecting one of the filter buttons.

Customize your experience

The All-In-One search experience is a lightweight popup window in your IDE. You can customize the experience by resizing and moving the window as you desire. You can even further customize this experience by either using the search popup in an easily dismissible, type-and-go form or a sticky form.

To use the All-In-One Search in an easily dismissible, type-and-go form, make sure the “Keep search window open” checkbox is unchecked. In this experience, simply selecting a result (via keyboard enter or mouse-click), clicking outside of the window, or pressing esc will cause the window to dismiss.

To use the All-In-One Search in a sticky form, make sure the “Keep search window open” check is checked. Now, unless you actively press the “x” in the top right corner of the window, the window will remain in front of your editor even if you click away, type in the editor, or select a result. This functionality can even enable you to drag the search window onto a different monitor so you can code on one screen and search on another!

Screenshot of All In One Search highlighting how to make the window sticky and stay on top of the editor

Try it out and share your feedback!

In order to try the new All-In-One Search experience, please download Visual Studio 2022 Preview 3

We would love to get your feedback on the new search experience so please give it a try and let us know what you think! You can share any feedback via this suggestion ticket and leave comments with any thoughts!

Denizhan Yigitbas Product Manager

Follow


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK