So i’ve noticed in quite a few of my blogs that people have complained about the #region’s we include when you’re using Implement-Interface. Probably the most frustrating thing is that if you take the following steps:
- Implement some interface on a class of yours
- add a new method to that interface
- implement the interface a second time to get the new method stubbed out.
You’ll end up with code that looks like:
class C : IFoo
#region IFoo Members
public void Foo()
throw new NotImplementedException();
public void Bar()
throw new NotImplementedException();
This is a pretty unpleasant experience as you know have to go in and manually clean up the regions that we’ve f****ed up. This is especially bad when implementing some interface with a large interface hierarchy. So what’s the right thing to do here? Well, we should correctly re-use regions when adding new stubs from the same interfaces. However, due to our current implementation this is actually pretty tough to do. In the past we used to generate each stub manually and we could place it anywhere in the file. However, this was a very unpleasant experience. You’d get a lot of flashing as you saw the stubs being spit into the editor. In order to improve that we generated the code for all the stubs and then just spit it in one go at the end of the file. This makes the experience quite nice: just click “implement interface” and a moment later it’s all done. So what can we do if the “right thing” isn’t available? Well, we could just provide an option to not spit out the #region’s. And, as this is actually something that has been requested by some people since they don’t like #region’s in general, it seems like a perfectly reasonable thing to do.
Now, internally, we already have a way to control this behavior using our built in schema for defining options. All of our other options go through this same mechanism, so it was pretty trivial to hook it up to UI like we’ve done with many others. The end result is this:
(you can see the new option exposed in the UI in the red box)
Will we go ahead with this in Whidbey? I have no idea. Will we go ahead with this post-Whidbey? I have no idea. I’m generally opposed to providing options unless they are absolutely necessary. Rather, I’d like to just do the right thing and not need an option at all, if that’s possible.
Also, we’re a phase of development called “visual freeze”. During this time we try not to change the UI at all (unless completely necessary). Why? Well, first of all the localization costs are huge. VS is localized into many languages and any change you make has a 10x cost because each language team needs to do all the work to make it available for their native language speakers. Second of all, there’s a UE cost to this as well. We need to document this new feature and explain how it works. That documentation then has to be localized again. And, of course, if any of the documentation refers to this image then it will need to be recaptured in every place appropriate. Basically, the cost is huge and it is strongly discouraged if not necessary.
Finally, we are trying to shut down. We don’t want to make changes that could destabalize things, and we also don’t need to overload QA even more since they’re working like mad with us to raise the quality of the product super high so we can ship. Even a little change like this which seems incredibly simple to make could potentially cause problems, and that added cost means less time spent on the rest of the stuff we want to ship.
So, given all the costs i wouldn’t want to go ahead with this change solely to help out this scenario. However, if we could combine a whole lot of changes in one, it might make the average cost a lot lower. i.e. if we wanted to add 5 new options then it woudl be better to get it all done at once rather than to do each one individually.
So are there other little intellisense options that you’d like to have some control over? i.e. things like: disabling all smart tags, turning off brace matching, etc.
In general are there options to control current features taht you feel are missing?