17.9 Preview 3 brings exciting changes to Code Search

Leah Tran

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.

33 comments

Leave a comment

  • Tim Wörner 0

    Looks very good!

    It would be also great to have more filter options in the future such as hiding generated files.
    Currently when I search for a .razor file, I get also in the result panel the generated files such as Mycomponent.razor..ide.g.cs –
    which I can’t click on

  • John King 0

    what about `endpoint` search , in a large project, it’s often hard to find the route method in a asp.net core project, In IDEA u can double click `SHIFT` and search a route path, and then it’s give u a spring endpoint result , and u can click to jump to the method

  • James Best 3

    Is there any chance in heaven that we could EXCLUDE commented lines in search?

  • Martin Strachota 0

    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 0

      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.

  • Andreas Saurwein 0

    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 0

      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 0

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

  • Alastair Taylor 1

    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 0

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

  • Gabe Hudson 1

    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 0

      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.

  • Mark Dell 0

    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 0

      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.

  • David S. 0

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

  • Hollman, David 0

    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 box seems to get confused and thinks I’m trying to enter in one of its own codes like “t:”. The effect is that the “c:” or “d:” prefix becomes sticky… the next time I open the search box, it prepopulates with that nonsensical code. This messes up the next thing I type or paste into the box.

    A second problem I anticipate is that anyone using a drive whose letter is actually “t:” or “m:” etc., I expect those paths would not be understood correctly.

    The choice of colon syntax for this feature seems unfortunate given that its been around for decades with the other meaning.

  • Alexandre Grigoriev 0

    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 0

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

  • Peter Nimmo 0

    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 solution, first as its not supported by “Code Search”, and the 2nd is that although the task can be done using the Filter window of the Solution Explorer, when you enter the name of the project in the filter it matches against headers, project references, assemblies, symbols, and external dependencies. What makes it worse is that you may see the result start to appear in the search results but as the list gets updated with more matches, and you try and click on the project by the time you left click the mouse the result has fallen further down the list, and you haven’t managed to zero in on the project you are searching for.

    Please add ‘:p’ projects to the possible filters in the code-search.

    • Leah TranMicrosoft employee 0

      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.

  • Anthony Steiner 1

    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, etc.

    And an option to quickly scope to File, Project or Solution, while Solution being the default one would be nice.

    • Leah TranMicrosoft employee 0

      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 details there about why this would be helpful and what you’re looking for!

      Scoping is also a great suggestion that we’ve been tracking in this ticket. Please feel free to contribute more to it!

Feedback usabilla icon