In the file Foo.razor, I have the code <span style="font-size: smaller">. When I search for "font-size: sm" in the entire solution, there are 3 results, 1 of course in Foo.razor. But when I add an "a", so I search for "font-size: sma", I only get 2 results. Visual Studio does not find it in Foo.razor. Why and how can I get really all results?
Adding more letters does not help. With less letters, the text is found in Foo.razor. But I do not think, it is the number of letters, because searching for "font-size: sma" does deliver results, but not the one in Foo.razor.
I know, there is an issue with the search results, described here. But the accepted answer does not solve my problem.
Here's a screenshot of my search window:
Many thanks!
Related
I'm looking for a way to find a string in my entire solution's code, i.e. just the effective code excluding the comments, in Visual Studio .NET 2008.
I'm working on Visual Basic code, so the comments in that language begin with a single quote '.
What you are looking for is probably Find Symbol (ALT+F12). This should limit your search to symbols in your code, though you probably cannot search for keywords this way. You can tell it to look in your entire solution and even use Match substring if that's what you want.
Our Source Code Search Engine understands language element structures (e.g., knows what is a keyword, what is comment, a number, etc.) and will allow you formulate complex queries in those terms. Because it understands language structure, it can do searches that are not confused by whitespace or comments (unless you insist).
I used to be able to search for a text in every file in solution, like that: http://vvcap.net/db/lWMPaSHxormUrFYlLo0Q.htp . After upgrading to VS2010 SP1, this doesn't work anymore:
Find all "description", Match case, Whole word, Subfolders, Keep modified files open, Find Results 1, "Entire Solution", "*.*"
No files were found to look in.
Find was stopped in progress.
What's interesting, I can still search if I know file extension, like this: http://vvcap.net/db/IFr8jCUa7J79sauBsNFC.htp :
Find all "description", Match case, Whole word, Subfolders, Keep modified files open, Find Results 1, "Entire Solution", "*.cs"
...
...
Matching lines: 485 Matching files: 109 Total files searched: 970
Anyone knows wtf is going on here, and how to get around this?
I don't know what happened, but now my VS is searching for "*" again. Maybe after last windows update... I have no reasonable explanation as to wtf happened
It's a known bug. You can get the visual studio search results to appear by using CTRL + Break in the Find Results window
I'm curious what the programming terms or methodology is used when Google shows you the "did you mean" link for a word that is made up of multiple words?
For example if I type in "redflower.jpg" It knows to break that up into Red Flower
Is there a common paradigm for doing that sort of operation? Would a Lucene search give you that?
thanks!
If google does not see a lot of matching results for reflowers.jpg, it might then try to cut the words in multiple words until it finds a lot of matching results.
It might also recognize the extension (.jpg), recognize the image extension and then try to find images with the similar name.
If I would have to make an algorithm like this, I would use an huge EXISTING database (either a dictionary or a search engine) and then try what I said in the beginning of my post.
Perhaps they could to look at what other people do when they have searched for redflowers.jpg? Maybe a number of people searched for "redflowers.jpg", didn't click on any links, and then searched for "Red Flower" and found some results worth clicking on.
Of course they would have to take into account that the queries are similar (contain matching strings), otherwise some strange results might appear.
I am refactoring a C++ codebase in Visual Studio 2005. I'm about half way through this process now and I've commented out a lot of old code and replaced or moved it. Now I'm searching to see that I have to change next but the search function keeps bringing me the old commented out stuff I no longer care about. I don't really want to delete that old code yet, just in case.
Is there any way I can search all files in the solution and get results ignoring what is commented out? I don't see a way in visual studio itself, is the perhaps a plug-in that would do it?
As the other provided solutions didn't work for me, I finally discovered the following solution:
^~(:b*//).*your_search_term
Short explanation:
^ from beginning of line
~( NOT the following
:b* any number of white spaces, followed by
// the comment start
) end of NOT
.* any character may appear before
your_search_term your search term :-)
Obviouly this will only work for // and ///-style comments.
You must click "Use Regular Expressions " Button (dot and asterisk) on your find window to apply regex search
In newer versions of visual studio .net regex is used which has a slightly different syntax:
^(?![ \t]*//).*your_search_term
My take:
yes you can use regular expressions, those tend to be too slow and thinking about them distracts from focusing on real stuff - your software.
I prefer non-obtrusive semi-inteligent methods:
Poor man's method:
Find references if you happen to use intelisense on
Or even better:
Visual assist and it's colored "Find all References" and "Go To" mapped to handy shortcuts. This speeds up navigation tremendously.
If you comment your old code with // you can use regular expressions while searching for something in your codebase. Something like this for example: ^[^/][^/].*your_function_name.*.
Previous answer gave a false-positive on cases where otherwise matching lines were placed on lines containing other source:
++i; // your_search_term gets found, don't want it found
So replaced the :b* with .* and added the <> so only entire words are found, and then went after some of the older C-style comments where there's a /* on the line:
^~(.*//)~(.*/\*).*<your_search_term>
In my case I was hunting for all instances of new, not amenable to refactor assistance, and boatloads of false-positives. I also haven't figured out how to avoid matches in quoted strings.
Just to add on, as I was doing a "find all" for division operator used in the code, used the below to exclude comments as well as </ and /> from aspx files:
^~(.*//)~(.*/\*)~(.*\<\/)~(.*/\>).*/
In Visual Basic within Visual Studio 2015, I was able to search for text outside of comments by adapting glassiko's comment from the most upvoted answer
^(?![ \t]*[']).*mysearchterm
And in C# you would use glassiko's comment exactly as it was
^(?![ \t]*//).*mysearchterm
Better use \s I think. ^(?![\s]*//).*your_search_term
delete the commented out code, it is in source control right? there is no need to keep it in the file as well.
I've been using usenet searches since about 1995 to get programming information, mostly for microsoft APIs. First searching via dejanews, and now google "groups" which bought out dejanews. Over the last few years I've noticed a steady decline in the quantity of search results for usenet from google, and today I find I'm completely unable to get a working usenet search on their advanced group search page. I'm used to searching on "microsoft.*" sometimes suplemented with "microsoft" or "microsoft*". Just try to find a post from 1996-1998 time period on "database" in either the comp.* or microsoft.* hierarchies, and if you can do it, please show your search expression. There should be thousands of results.
http://groups.google.com/groups/search?safe=off&q=database+group%3Amicrosoft*&btnG=Rechercher&as_mind=1&as_minm=1&as_miny=1996&as_maxd=1&as_maxm=1&as_maxy=1999&as_drrb=b&sitesearch=
seems to work nicely... 994 results (no thousands but still...)
It appears to be problem with the advanced search form. I can't get the one at
http://groups.google.fr/advanced_search?hl=fr&q=&hl=fr&
to work either. But I can use the basic form with "database group:microsoft*" and I get many results as expected.
http://www.google.ca/groups/search?safe=off&q=database+group%3Acomp.*&btnG=Search&sitesearch=
returns 3,000 results
The advanced search isn't working for me either:
Broken advanced search results URL
However, removing lr=selected from the query string in that URL makes it work, for some reason:
Working advanced search results URL
In fact, hitting the search button again on the broken advanced search results page will return those results as well for me.
Or actually, it's only partly working, since entering multiple comma-separated groups in the advanced search form (or using the group: search operator) doesn't quite work as expected and ends up adding all the words in the additional group names as search keywords too.
You could try learning Julian dates and use the daterange search operator:
Search results using daterange: