Reputation: 4385
I want to find all usages of my react component in code.
I tried <Button>
but Special chars <>
are not supported.
Tried "Button"
and i get "Button"
and button
with lowercase as results as well.
So exact match is also not supported.
Is there is a way to find a string exactly without any additional results?
Upvotes: 0
Views: 1759
Reputation: 30372
Unfortunately, search symbols (<>
and ""
in your scenario) is not supported in code search.
In tfs the symbol ""
is used for finding an exact match to a set of words by enclosing your search terms in double-quotes. For example, "Client not found".
Is there is a way to find a string exactly without any additional results?
Yes, but it seems a little complex, just reference my answer in another thread:Is there a way to make TFS code search recognize the "@" symbol?
Checked for some characters in code search. You can't use the symbol characters except
*
and?
as part of your search query, which including below characters: . , : ; / \ ` ' " @ = ! # $ & + ^ | ~ < > ( ) { } [ ]. The search will simply ignore these symbols.But you can use wildcard characters * and ? to broaden your search.
You can use wildcard characters anywhere in your search string except as a prefix in a simple search string or a query that uses a code type filter. For example, you cannot use a search query such as *RequestHandler or class:?RequestHandler. However, you can use prefix wildcards with the other search filter functions; for example, the search query strings file:*RequestHandler.cs and repo:?Handlers are valid.
Please see Broaden your search with wildcards for details.
If you want to search the strings including these symbol exactly(such as '@' here), you can code search with other strings (eg,
testexample.com
here) to narrow down the scope first, then copy the specific code to text editor which support the symbols (eg, Notepad++), then search stings with the symbol characters.Besides, if you are using Git, another workaround is using the code search tool Hound: a lightning fast code search tool, it supports the symbol characters. Reference this thread to use it: How can I publish source code (Visual Studio) on a intranet?
Also, there is a User Voice here to suggest the feature, you can go and vote it up to achieve that in future.
Upvotes: 2