Implementing Interface Methods

When I create a new class and I assign an Interface to it, are there any keyboard shortcuts or ways for me to know what methods need implementing other than looking at the Interface source?

For example, in IntelliJ I can press CMD-I and get a list of all of the methods that need implementing.

Posts

  • BenBishopBenBishop USBeta ✭✭

    Thanks Jeff! That'll work great for me.

    One other question, is there anyway to extract an Interface or Super Class from a class in XS?

  • mhutchmhutch USMember, Xamarin Team Xamurai

    There's no "extract interface" or "extract superclass" at the moment, though it could easily be added by an addin.

    You can access the "implement interface" command (and any other context action) from the keyboard using alt-enter.

  • BenjaminBaronBenjaminBaron USMember

    Extract interface would be extremely useful! Now that I'm using DI, I'm making an interface for most new classes, and am currently doing it by hand.

  • GaryMeyersGaryMeyers USMember

    Two years ago, Jeffrey mentioned that "...you can right-click on the interface and in the "Refactoring" submenu..." but I'm not seeing a Refactoring submenu today (a screenshot is attached for IUICollectionViewDataSource). Was this feature removed or am I doing something wrong?

  • mhutchmhutch USMember, Xamarin Team Xamurai

    @GaryMeyers: It's still there, try right-clicking without selecting.

  • GeorgeCookGeorgeCook PEUniversity ✭✭✭
    edited March 2015

    I raised a ticket asking for some jetbrains style love.

    [https://bugzilla.xamarin.com/show_bug.cgi?id=28554]

    While it's true we can write addins (which is awesome), we're all pretty busy learning about Xamarin and tyring to get it visible in our respective companies.

    If these are easy features to do as addins, then presumably they're really easy(tm) to do for the IDE team.

    I know the platform's moving at breakneck speed, and I'm actually really impressed with xamarin studio, I'm surprised at how good it is; but, I think if Xamarin could throw someone at the ide for a week with a misison to add some additional enterprise level refactoring support that that would make our jobs of selling Xamarin to our companies much easier, and raise our code-comfort and productivity.

    My list as it stands is:
    extract inteface/base class,
    better navigation in given source file (i.e. hotkey to show all members/filter/navigate to, without needing to click or scroll),
    text-filter for the override/implement menu,
    update method signature (i.e. add properties/remove properties) - that's a nice to have.

    Other essential is : better code completion in xaml, it's such a drag writing a decent sized app with lots of custom controls and having zero code completion support for anything that is a custom control.

    @mhutch, is there a place we can vote for features? I'm just using the bug tracker for now; but it'd be great if we, had a mechanism to you guys know the features we're needing,

  • GeorgeCookGeorgeCook PEUniversity ✭✭✭

    also, a huge grievance, is that there's no xaml formatting.. if we can't get code completion, we should at the very least have that.

    [https://bugzilla.xamarin.com/show_bug.cgi?id=28596]

  • mhutchmhutch USMember, Xamarin Team Xamurai

    You can vote for features on xamarin.uservoice.com.

    By "easily added by an addin" I meant that it's easy to plug features in using the addin system, not that the features themselves are easy :)

  • GeorgeCookGeorgeCook PEUniversity ✭✭✭
    edited May 2015

    @mhutch I took your advice.. it's not great; but it fills the gap:

    https://github.com/georgejecook/EditorComfortAddin

    Unfortunately I can't get it to build with the monodevelop distributor - say's that it can't find the solution file, so I can't share it with the rest of the community :(

    I also need to refactor it to use the string matching you guys use in your search box and completion popup.. dind't get around to that yet, and my string matching is a bit buggy.

  • mhutchmhutch USMember, Xamarin Team Xamurai

    @GeorgeCook very cool!

    To get it to build on the addin build server, in your addin-project.xml file, the BuildFile element needs to match your sln filename and the AddinFile element needs to match the compiled addin's path+name.

  • GeorgeCookGeorgeCook PEUniversity ✭✭✭
    edited May 2015

    @mhutch thanks. One other question on addins, if you don't mind - how do I extend existing functionality? I want:

    To add the ability to go to declarations in xaml files,
    Give more xaml formatting options (I can never get it, "just so"),

    I can go ahead and add these as separate features, repurposing monodevelop code; but ideally, I'd like to not use a different keyboard shortcut for going to declarations, and would like to be within the worlds of "format on save" and the normal hotkeys for formatting (even though format on save is currently broken for xml)

  • mhutchmhutch USMember, Xamarin Team Xamurai

    It's possible to add handlers for existing commands. You need at add a command handler into the command scan path. See this (mostly up to date) doc: http://www.monodevelop.com/developers/articles/the-command-system. For Go to Definition, you'd typically put the handler on a TextEditorExtension for that file type.

    Adding formatting options to the autoformatter using an extension is ~impossible, however you could override the formatter for that file type with a new one by registering the new one before the existing one (using the insertbefore attribute). Or you could contribute changes for the formatter in MonoDevelop and those would end up in XS.

Sign In or Register to comment.