by Anchor · 10y ago · 0 comments
New features in VS2017 that were already in ReSharper include configurable suggestions from static analysis, Ctrl+T navigation (it even uses the same shortcut), structured find references, intellisense filtering, multiple refactorings in given scope, live unit testing and coverage (in ReSharper Ultimate).
This is great and a bit amusing at the same time, but as a user, I like the improvements we get.
You're definitely correct that many of these things have already appeared in Resharper. However, that wasn't the point of us building them. We invested in the Roslyn platform many years ago so that not only could we share and leverage code across all our languages, but so that other people could plug in as well to add the sorts of enhancements they would like.
Currently, We've moved C#, VB, TypeScript, JavaScript, and now Xaml, onto the Roslyn platform. Because of this (note that some of this is bleeding edge), not only can we all share a common infrastructure for things like Find-References, IntelliSense, and Refactoring, but 3rd parties can now plug in as well and add their own capabilities.
For example, all the refactorings we've offered are ones that others could have as well. We just happen to think that, over time, we should continually be improving the core set we provide so that you can get a highly capable and powerful experience out of the box without necessarily having to go install a lot of extra plugins. Of course, if you do find plugins (including resharper) that you find valuable, then we want you to def go out and enhance your experience with them.
I hope you get a chance to try this stuff out. As always, please file feedback/issues on github.com/dotnet/Roslyn
Thanks!
Yeah, I know, many of the features of ReSharper are something VS should have had for a decade, regardless whether ReSharper has them or not. We - VS users - tried to tell VS dev teams in around 2005 that JBuilder (of all things, if you can remember that - it got eventually Eclipsed) had better refactoring and navigation tools than Visual Studio. The message from VS has consistently been that you are going to fix that, and when I heard of Roslyn, I though that this time it may be really happening. Only it has been ten years. Luckily .NET/C# was marginally better from developer perspective than JVM/Java from the beginning (the difference has grown ever since), and ReSharper (and other plugins) helped to keep Visual Studio afloat until today.
Now that Microsoft has embraced open source, community contributions, shorter release cycles, .NET Core, etc., I think you have a great foundation for the next ten years of .NET.
Oh, rest assured, I will continue to bug you guys through different channels.
One annoying moment was when it claimed a variable would always be false, and running in the debugger proved it could have both values. I also had to turn off a lot of rules because the refactoring suggestions I had would've made the code cleaner at the cost of adding indirections or allocations.
I was doing a 2D skeletal animation system for Unity3D at the time and wanted raw performance much more than anything else. We ended up pushing 10K sprites on mobile devices (thats about 200 dynamic meshes of 50 sprites each - the best existing solutions we could find had a performance cap of 10-20 meshes) but that was the least idiomatic C# I've ever written; structs and refs everywhere in tightly packed contiguous memory with components being dumb indices into these arrays.
Its a wonderful tool, but it requires some critical thinking to not naively apply everything it suggests, which in my case ended up being easier to work without ReSharper than with it.
But yeah, static analysis can yield false positives if you use for example reflection (one more reason to avoid it in most cases), but there's an option to turn a specific message off for particular line, class, etc. You can also edit ReSharper suggestions per solution basis, so if there are some special requirements, they can be incorporated into its behavior.
It wasn't complaining about structs or refs but wanted LINQ everywhere, anonymous lambdas and other high level constructs in place of high-performing but harder to read ones.
I wasn't using reflection either, it was something like this simplified pseudocode (off the top of my head, I haven't touched that codebase in over a year):
var completed = false
for each line in timeline do completed = completed || tick(line)
if completed // here it complained its always false
There was more to it (to handle time offsets and multipliers, disabled lines and whatnot) but thats the gist of the algorithm.
After disabling or tweaking rules every day I just decided to uninstall it, and as I said its a wonderful tool - just not for that specific task at that specific point in time :)
It'd generate some abhorrent Linq statements in place of very clean, readable code, but just trying to grok what those statements meant made me so much more comfortable with it.
And of course I'd always go back and undo the changes, but occasionally it'd do something that was the right balance of nifty and readable that I'd try to salvage out of the larger statement and reuse elsewhere.
It's true it takes some effort to tweak it to cut down on noise from its analysis (and IntelliJ has the same issue), but I think it manages to be worth it over all (assuming you have that time and effort to contribute, which it sounds like you didn't at the time)
Adjusting the rules and settings of R# is a daunting task, I agree. However, usually if I have special requirements for a project, I just set Inspection Severity to none for the language features I don't want to use, and that solves the issue for that project.
If done right, this will work for both product and plugin implementors.
It is also worth noting that the structure of the code affects the static analysis and other features. It is faster to operate with lots of smaller isolated modules than large and coupled ones. The same techniques that kept C++ project compile times manageable, keep the static analysis real-time in C#. One more reason to decouple modules.
ReSharper | Options | Environment | Search & Navigation | Rich mouse navigation in the editorI'm kind of curious what they'll do with their C# IDE, Rider, and how much they can share between that and ReSharper. With Visual Studio itself starting to go cross-platform, I'm not sure how long that niche will stay open.