December 30th, 2024

Go to line anywhere with Code Search for Visual Studio 2022

Leah Tran
Product Manager

Finding the exact line of code where an issue is occurring can be like searching for a needle in a haystack. Whether you are debugging an error on line 43 of a file or diving into a specific section of code, you can efficiently jump to the right places with this newest addition to Code Search.

In Code Search, you can now jump to a specific line in the current file or another file, making it faster and easier to move around your codebase.

Navigate to a line in the current document

No need to scroll endlessly to find a specific line. With the updated Code Search, you can swiftly jump to any line in the current document by simply typing colon + line number. For example, typing :39 instantly takes you to line 39 in the active file.

Navigate to a line in the current document :39 items shown

Navigate to a line in a different document

But that’s not all! You can also navigate to a specific line in a certain document by appending the file name with a colon and the line number. For instance, entering Order:43 will direct you to line 43 in the Order.cs file. If you don’t specify the exact file name, the search will try to find the best match for you.

Navigate to a line in a different document Order:43 items

We appreciate your feedback

Your feedback is invaluable to us. It helps us make Visual Studio better with each update. We are excited to see how this new feature will enhance your coding workflow.

From feedback we received during Previews, we’ve already got work lined up to support another format for line navigation. See more at Support Filename(line,column) format in Code Search – Developer Community (visualstudio.com).

We look forward to hearing about your experiences and suggestions.

Author

Leah Tran
Product Manager