Is it possible to write all the comments from interface fields/methods to their implementations via resharper or another tool? I know this is working when implementing an interface to a fresh class, but how can i do this when refactoring comments?
If your field/method implementations don't have doc comments then they will pick up the doc comments from the interface any way, you can see these using Resharper's quick documentation (Resharper->Edit->Show Quick Documentation... or CTRL+SHIFT+F1).
You could also try Ghostdoc to help with the creation of your doc comments.
I am not sure that there's any way for your implementation comments to change automatically if you update the underlying interface ones though.
Related
As the title says, I would like to build a VS extension that's able to react to certain changes made on the editor window (for various languages). Not necessarily an adornment.
To do this I would like to be able to analyse the editor document through the Roslyn service API (that if I understood well is now part for the Microsoft.CodeAnalysis).
Can someone indicate some documentation?
What's the best practice to do this?
What are the interface to import via MEF?
As example you can export a custom ISuggestedActionsSourceProvider to add new feature in the light bulb, you can use ExportCodeRefactoringProviderAttribute to add a new refactoring, also you can export IClassifierProvider and ITagProvider to classificate a elements in the text editor, import ITextDocumentFactoryService to retrieve the current VS Document by ITextBuffer and etc.
Also you wouldn't be enough to use only Microsoft.CodeAnalysis for some kind of analyzing, so you will need to add a some additional packages in these cases. As example these packages can be Microsoft.CodeAnalysis.EditorFeatures.Text, Microsoft.CodeAnalysis.Workspaces.Common and etc.
If you want to get from community the more concrete answer you should concrete what exactly do you want in the question.
Also you can check a more useful links and examples: Roslynator are refactoring and analyzing a code, Getting start editor extensions, Light bulb guide, Classification elements for highlighting
Is it possible to identify classes that implement IDisposable. I was hoping to do so in the Visual Studio Color settings or with an addon.
I don't use Resharper and I have heard that FXcop has this feature. I was looking for something different than these options.
You can right click on the type and select go to definition. It should show you the public members of the class and the interfaces it implements. The object browser can also be used to see this.
However Brody's answer is usually the simplest way and works so long as someone hasn't implemented a method called Dispose but not implemented the IDisposable interface.
You can use the Class View and Object Browser to determine it. But going to the definition is the best idea as the MetaData generated will show you all the methods and the inheritance of the class
Look for the method Dispose() on the class.
Not at a risk of coming across the wrong way (so please don't take it that way), but the best way is to know your code and know the Framework. You should only need to look something up a couple of times to learn which are which. There is not really a dependable way apart from either checking if .Dispose() is a method (which always does not work, as Dispose can be private on some of the Framework classes, such as ManualResetEvent where it is protected), or by going to the definition to find it.
That is not to say that someone could not write an add-in that would do it. I don't see any issues with the technical feasibility of that. A cursory search of Google didn't turn up any existing add-ins that do it, but there might be something out there already.
I am primarily a fluent .NET developer (as can be seen from the amount of posts and threads I make about .NET), but I thought it would be good to learn RoR.
In doing so, I have a few questions about the architecture of the language (Ruby) and the framework (RoR):
1) In .NET, every object is derived from System but inherits System.Object. So when I type System., I get a list of namespaces and then in those namespaces, classes and more namespaces.
Does Ruby not have this sort of hierarchy?
2) In some cases, I don't get the intellisense. For example, I wrote the class as outlined here (http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer) but in the line recipients user.email, nothing comes up when I type "user.".
Any idea why?
Thank
Dave Thomas (Pragmatic Programmers) has an excellent screencast series on the Ruby object model/metaprogramming. We watched this in a local Ruby user's group. The series isn't free, but it's not expensive either. You might want to check out the free preview to see if you think it is worth your time.
And to give you an answer. Yes, everything in Ruby derives from Object. You can find the docs on this at http://corelib.rubyonrails.org/. Look for the Object class.
I'm not sure why you aren't getting intellisense, partly because you haven't specified your IDE. It's possible that you can't because you've added the method dynamically and no intellisense is available.
If we compare .NET to Rails then yes, there is this kind of hierarchy there. And in general, you can achieve this kind of hierarchy in any Ruby application via using modules.
I guess it's because of Ruby's dynamic nature.
Ruby is a pure OO language meaning that everything from classes to objects derive from the Object class.
Download NetBeans. There is full intellisense support for Ruby and Ruby on Rails.
http://www.netbeans.org/features/ruby/index.html
Intellisense support probably won't get you what you think it will get you. Because Ruby is a dynamic language, Intellisense, or code completion, is difficult. What you will find is that either the drop down is so flooded with possible completions as to be useless. Or in your case nothing at all.
It's not 100% useless, but I have never found it terribly valuable.
Does anybody use the Class Designer much in Visual Studio?
I have downloaded the Modeling Power Toys for 2005 and have been impressed with what I've seen so far. The MSDN Class Designer Blog doesn't seem to have been updated for a while but it still looks quite useful.
Is the Class Designer a quick way to build the basic application or should I just work out on paper and then start coding?
Thanks
As a visualization tool, or for exploratory purposes (drawing up multiple options to see what they look like) it's not bad, but generally I find the object browser does fine for most stuff I care about.
As a code generation tool, it's a terrible idea.
The whole idea that we will design all our code structure first, then fill in the blanks with small bits of implementation is fundamentally broken.
The only time you actually know what the code structure should look like, is if you've done the exact same thing before - however then you can just use your previous code, and you don't need to draw up any new code in any kind of designer.
If you decide ahead of time to use a particular class structure before you've actually tried to solve the problem, there is a 100% chance that you will pick the wrong design, and shoot yourself in the foot.
Short answer: No.
Longer answer: No, not at all. There's a reason it hasn't been updated.
[EDIT] # MrBrutal - Sorry - do you mean to generate code or just represent a design? Because I took your question as to generate code for you.
I guess this is old, but I use it a lot. It could definitely be improved, but I find it extremely useful to be able to visualize my class structure, and to be able to jump to a specific class or method by clicking on it visually.
It's also slightly easier to add classes/interfaces with than the solution explorer, although the new files always end up in the root folder, instead of the same folder as the CD.
The main benefit I find is to be able to see a group of closely related classes at once. I think the best approach might be to have a single CD for each code folder/namespace.
I've used it a couple of times to get some decent looking class diagrams to put in presentations/blogposts etc. But thats about it...
Any suggestions on other simple UML/class diagram tools that is easy to use and create some nice looking diagrams? Must be able to generate diagrams from .NET code.
I have tried it out couple of times, mainly for viewing existing classes.
If it would show all the relationships, it would be more usefull. Now it only shows inheritation.
I find it useful sometimes, more often for documentation afterwards.
It's a new little utility, but I don't think you get the full functionality in VS Pro - I think you need Architect's Edition.
The comments here suggest that few people find the class designer useful.
Amusing to note that Microsoft designed the class designer to be a useful replacement to useless UML (UML diagrams being untrustworthy once they lose synchronisation with source code).
The trouble with class diagrams is that they tell us what we already know.
I only use the class designer to display my existing classes, but I don't use it the other way, e.g., design your classes there then let it generate the code.
Someone on here recently recommended BWToolkit, and it really impressed me, so I started googling for more IB plug-ins. I've found a couple on random blogs, but haven't been able to find any kind of repository/aggregator for them. Anyone know where I can find more of these?
Thanks.
I just created a page on CocoaDev to list them [edit: question originally just said “Interface Builder plug-ins”, did not mention Cocoa frameworks], with the two I know of listed.
Well that's a good start. I guess that wiki page is the de-facto repository, for now. Seems like there's not much out there.
You are not looking for Interface Builder plug-ins. You think you are, but you aren't. BWToolkit, the example you use in your question, is not an Inteface Builder plug-in. Brandon bills it as an Interface Builder plug-in but it is actually a framework and a plug-in. The framework contains the actual controls. The plug-in contains the integration with Interface Builder.
So really, what you are looking for are frameworks that contain or provide Interface Builder plug-ins. I have changed your question to reflect that, so it is more likely to be found by people using Google to search for similar things in the future.
I know what I am looking for. Not all frameworks contain IB plugins. I am looking for a specific subset of frameworks, those which contain IB plugins. An IB-plugin without a framework is useless, therefore the framework part is assumed. I am NOT looking for regular old frameworks, so stop trying to change my question to that. Your additions only seem to be confusing people.
I have reported your post, hopefully moderators will be able to stop your obnoxious behavior.
"Without a framework, what would you have to plug in to IB?"
Your words, not mine. Anyways, I'm done arguing this with you. Just remember that I can roll back for every time that you edit.
It's clear you have a lot of experience in this field, but instead of offering answers you decided to nitpick where there are no nits to pick.
Additionally, you have not "changed the question to refelct that," you have changed the question to a completely different question. I would have though that after four rollbacks you would relaize that you're doing more harm than good. Just stop, okay?
Of course, Chris Hanson is absolutely correct when he says that an Interface Builder plugin is useless without an accompanying framework. Interface Builder merely provides a graphical way to manage objects in a framework; without the framework itself, Interface Builder has nothing to manage.
However, I do think that there is a completely valid sort of Interface Builder plugin that wouldn't necessitate the installation of an accompanying framework, and that would be one that provides Interface Builder integration features for objects in Cocoa/Cocoa Touch which would otherwise appear as just generic objects.
For those of you who come to this page Google, please recognise the difference between Interface Builder plugins and frameworks: even the examples mentioned above work on frameworks (they could be Foundation, AppKit, UIKIt, etc.)