January 17th, 2024

17.9 Preview 3 brings exciting changes to Code Search

Leah Tran
Product Manager

With the release of 17.9 Preview 3 dropping today, we are bringing some exciting enhancements to the Code Search (also known as All-In-One Search) experience. Since our last update with the search experience, we’ve been hard at work refining the experience and ideating ways to add to the experience. Now, you can search for any word or string of characters across your solution, supplementing file and symbol results from your codebase. You can now search for local variable names, words in comments, parameter names, or any other string of characters across your codebase.

The added text support will help round out your experience using Code Search. If you’re looking for a more specialized text search experience, Find in Files (Ctrl+Shift+F) and Quick Find (Ctrl+F) have more options and functionality.

All-In-One Search window shows that text results show up as the full line.

Where can I find these?

The default Code Search experience (Ctrl+T or Ctrl+,) will include exact text matches when applicable, including items like comments and local variables that weren’t included before. Text results are deprioritized compared to files, types, and members, so it shouldn’t interfere with your current workflow.

For a text-only view, you can filter down to just text results by doing one of the following:

  • Click the “text (x:)” button below the search bow,
  • Prefix your search query with “x:”,
  • Use the keyboard shortcut `Shift+Alt+F`, or
  • Go to the menu option “Edit > Go To > Go To Text”.

In the text-only experience, there are also the options to toggle “Match case”, “Match whole word”, and “Use regular expressions” through the button at the far right of the search bar.

Try it out today and let us know what you think.

Full text support in Code Search is available by default in the Preview channel, starting from 17.9 Preview 2. (Edit: We’ve discovered that the feature may not be fully rolled out by default in Previews channels, but you can still enable it by going to “Tools > Options > Environment > Preview Features > Plain text search in All-In-One Search”).

It will also be available in the main release in version 17.9 as a preview feature, where you can turn it on by going to “Tools > Options > Environment > Preview Features > Plain text search in All-In-One Search”.

Closing

We appreciate the time you’ve spent reporting issues/suggestions and hope you continue to give us feedback when using Visual Studio on what you like and what we can improve. Your feedback is critical to help us make Visual Studio the best tool it can be! You can share feedback with us via Developer Community: report any bugs or issues via report a problem and share your suggestions for new features or improvements to existing ones.

Stay connected with the Visual Studio team by following us on YouTube, Twitter, LinkedIn, Twitch and on Microsoft Learn.

Topics
Search

Author

Leah Tran
Product Manager

33 comments

Discussion is closed. Login to edit/delete existing comments.

  • Anthony Steiner

    It would be nice to have something like the visual assist find in solution where you know parts of what you are looking for, for example you have a method:

    VeryLargeMethodName_Action() so you know "Very" and "Action" are parts of it so you search for "Very Action" space meaning AND operation, or maybe OR.

    Also an option to ignore comments should be important as well as ignoring generated files as other menitoned. Maybe ignoring files like .config,...

    Read more
    • Leah TranMicrosoft employee Author

      Thanks for the feedback, Anthony!

      We're looking into making the search experience smarter at handling these sorts of scenarios, but it should currently be capable at searching multiple non-adjacent terms as long as they're in the right order. If this is not the case, please report a problem so the team can look into it.

      I've created a new ticket for the suggestion of an option to ignore comments in Code Search. We would appreciate more...

      Read more
  • Peter Nimmo

    The code-search needs to be extended to off a Project option. Our product is built by around 7 Solutions which contain between 40 and 150 Projects in each, we need to built all these solutions to build the product. I also have a Master solution where I have combined these into 1 large Solution which has around 430 projects.

    It is very hard to zero in on the code of one project within the...

    Read more
    • Leah TranMicrosoft employee Author

      Thanks for sharing, Peter! We're looking into adding scope options (similar to Find in Files) to Code Search, as described in this suggestion ticket. We'd appreciate more details about what specific capabilities you need.

      Any examples you can share of what you typed in the search box and what you were looking for may also help us better understand your ask.

      Read more
  • Alexandre Grigoriev

    I wonder when an annoying problem with simple search will be fixed: The search scope changes by itself. Yes, it was reported long time ago and still exists.

    • Leah TranMicrosoft employee Author

      Hi Alexandre, would you be able to share the ticket to the report you mention?

  • Hollman, David · Edited

    I'm still using 17.7 and noticed one glitch. I often paste into the CTRL-, box a full absolute file path which starts with a drive letter. (Its easy to copy paths like this from my source control). That's a very convenient way to automatically and quickly navigate to a specific file.

    One problem that results from this is that since DOS path syntax of course starts with something like "c:" or "d:" the search...

    Read more
  • David S.

    Filtering all those text results out when searching for a member is such a great improvement!

    • Leah TranMicrosoft employee Author

      Glad to hear this. Thanks for sharing!

  • Mark Dell · Edited

    Will this also ignore files in folders that start with a “.”, just like the normal find (aka quick find) does when searching all files in the project or solution, even though VS 2019 never did that, and also give us no way to allow searching in those folders?

    • Leah TranMicrosoft employee Author

      Thanks for sharing this, Mark! I’ll make sure our team is aware of your feedback. We have an open bug on this issue in Find where the fix will be to make Quick Find search all relevant files.

  • Gabe Hudson

    New search features are always useful! That said, from a user experience standpoint, having multiple search options and keyboard shortcuts is not intuitive or friendly. I would love to see an effort to combine these various functions into a unified search/replace panel. Even if you just have the current functionality in separate tabs in the UI. Seems like a lot of duplicated effort?

    • Leah TranMicrosoft employee Author

      Appreciate the feedback, Gabe! It would be great to learn more about what features and functionalities you’d like to have combined into one window.

  • Alastair Taylor

    This seems to suffer from the same issue as reported here: https://developercommunity.visualstudio.com/t/Find-in-Files-STILL-returns-items-from-t/10365887 in classic Find in Files namely it is returning results from a TEMP folder

    Opened up a new issue here: https://developercommunity.visualstudio.com/t/All-In-One-Search-returns-data-from-AppD/10564496

    This has been a long standing issue in VS. It drives me mad every single day. PLEASE don’t surface results from a TEMP directory.

    • Leah TranMicrosoft employee Author

      Thanks for highlighting this issue, Alastair. I’ll make sure the engineering team is aware and looking into this.

  • Andreas Saurwein

    All right, updated now to Preview 3 (the about window shows version 17.9.0 Preview 3) and my code search looks just like before. No filter in the edit line, no “text (x:)” button. Typing like “x: // todo” brings some rather weird results, anything including “x”.

    • Leah TranMicrosoft employee Author

      Thanks for letting us know about this, Andreas. We will make sure it’s on in the coming Preview releases. If you don’t see the text search support in 17.9.0 Preview 2 or Preview 3, then you can turn it on by going to “Tools > Options > Environment > Preview Features > Plain text search in All-In-One Search”, selecting that checkbox, and restarting Visual Studio.

      • Andreas Saurwein

        Yes, that was it. And I thought I had all preview features enabled already.

  • Martin Strachota

    Thank you, it looks nice, I’ll definitely try it out!
    I find it odd that there’s no mention of this new feature in the release notes

    • Leah TranMicrosoft employee Author

      Thanks for letting us know about this! We missed the timing to get this into the preview release notes, so we are working on getting this into the notes for the main release.