Ayende @ Rahien

It's a girl

Why I LOVE ReSharper

image

I mean, just look at this. This is magic.

More to the point, think about what this means to try to implement something like that. I wouldn’t know where to even start.

Comments

Palesz
06/08/2012 09:23 AM by
Palesz

You just need to run a search query for concdi in case-insensitive mode, thats all.

nick
06/08/2012 09:29 AM by
nick

I don't think it would be too difficult. You could possibly do the search in about 5 lines of powershell using the $dte object in the package manager console.

Something like this in powershell http://stackoverflow.com/questions/3560823/how-can-i-get-only-classes-defined-in-the-current-project-in-envdte although I'm not sure how to get at files in the BCL.

ReSharper is an awesome tool though. Perfect if not for the performance decrease and lock ups.

Valeriob
06/08/2012 09:32 AM by
Valeriob

Brute force: waste of resources (memory, cpu), not much value added, and visual studio gets slower.

Simon Skov Boisen
06/08/2012 09:36 AM by
Simon Skov Boisen

Palesz, what search query though? A contains? That won't find anything in this case.

My guess is they split each symbol on capital letter and then do a largest common substring (or maybe levenshtein distance) search on each symbol-part. Then take all those symbols which has a match length of more than 0 in all of the capital-parts in the symbol. That way you get the symbols which contains atleast one character from the searchstring in each of the symbol-parts.

monnster
06/08/2012 10:03 AM by
monnster

They call it "fuzzy search", and it also works in Go to... commands. Yes, it's awesome!

Steve W
06/08/2012 10:20 AM by
Steve W

Resharper is both a great tool and an impressive piece of software in it's own right - I'd be a bit lost without it these days :)

Noel Kennedy
06/08/2012 10:57 AM by
Noel Kennedy

You can use a trie. When what the user has typed diverges from the entries in the trie you stop navigating the trie, take all the remaining nodes in the true and calculate the Levenshtein distance between them and what the user has typed. Should be pretty quick as long as you restrict it from happening high up the trie (say a minimum of n characters before this is done).

Aaron
06/08/2012 11:05 AM by
Aaron

If you'd instead typed, CD or CDE, Visual Studio without extensions would have provided similar suggestions, in case you weren't aware.

Juan Lopes
06/08/2012 11:29 AM by
Juan Lopes

Longest Common Subsequence.

http://en.wikipedia.org/wiki/Longestcommonsubsequence_problem

Rather trivial, C++ impl:

https://github.com/juanplopes/valladolid/blob/master/src/10066.cpp

tobi
06/08/2012 12:27 PM by
tobi

This feature is called "match on camelhumps". It matches on character case. It is awesome and I use it all the time. 4 letters are often enough to find any class unambiguously.

I don't know how to program without intellisense. I really don't. Who can remember all these names (and the compiler requires you to remember them without any mistake at all).

This leads me to the question: How do people program in dynamic languages? Are the heuristics their IDEs use good enough?

João P. Bragança
06/08/2012 06:30 PM by
João P. Bragança

A good dynamic language will take a different approach. As of 3.5 .net has 11,000 classes (http://blogs.msdn.com/b/brada/archive/2008/03/17/number-of-types-in-the-net-framework.aspx). I doubt ruby has that many in the core. OTOH a bad dynamic language like PHP has hundreds of functions in the global namespace, with no convention on argument order, making it impossible to use without a good IDE.

Roman D. Boiko
06/08/2012 09:42 PM by
Roman D. Boiko

http://en.wikipedia.org/wiki/Suffix_tree

Roman D. Boiko
06/08/2012 09:43 PM by
Roman D. Boiko

http://en.wikipedia.org/wiki/Suffix_tree

Roman D. Boiko
06/08/2012 10:07 PM by
Roman D. Boiko

It's pretty difficult to post on your blog: confirmation appears each time regardless whether CAPTCHA is correct or not, URI is not translated into a hyperlink, and paired underscores inside URI are interpreted as markup for italics. Let's try with double underscore on each side :)

http://en.wikipedia.org/wiki/Approximatestringmatching

Rodrigo Dumont
06/10/2012 02:17 PM by
Rodrigo Dumont

I love it because sometimes I can just memorize a short word for some common types in an application. And sometimes that short word can be really funny. haha

Leyu Sisay
06/11/2012 10:10 AM by
Leyu Sisay

A variant of this problem was on the final exam for the online course "CS212-Design of Computer Programs"

http://www.udacity.com/view#Course/cs212/CourseRev/apr2012/Unit/496001/Nugget/515001

Janus007
06/12/2012 10:27 PM by
Janus007

Why didn't I learn something new by all the comments?

Comments have been closed on this topic.