facebook

No Generate for TS classes

  1. CodeMix & Angular IDE
  2.  > 
  3. Webclipse 1.x Help
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #520505 Reply

    Fedor Losev
    Participant

    There are no Generate commands for TS like in other IDEs or, say, Java. E.g. Generate Getters/Setters, Delegate, Implement, Override methods, etc.. For an IDE I think it is a very useful feature if not a must.

    #520618 Reply

    support-tony
    Keymaster

    Fedor,

    Thanks for another useful suggestion. I’ve raised an enhancement request and we’ll surely look into providing such a feature, in a future release.

    #520619 Reply

    support-piotr
    Participant

    Fedor,

    I want to add a little bit more on this. It hasn’t been a high priority feature for us, because TypeScript is so much different than Java and it actually doesn’t require much of the basic IDE assistance, at least I don’t have a need for it when coding TS services in TypeScript. For instance Getters/Setters generation doesn’t make sense in a TypeScript class, as you have properties, which by default map to a field. However, we are looking into providing better content assist, so that when you type get and you do CTRL+SPACE, you’ll get list of fields for which you can get scaffolded getter method. Some of the improvements are already there – for instance first iteration on quick fixes to implement missing interface members.

    However, I would like to know how and when you use generators and which of them you’re missing the most, to better understand your needs. Could you please provide some more details?

    Best regards,
    Piotr Tomiak

    #520663 Reply

    Fedor Losev
    Participant

    I agree it is a bit exaggerated to say “a must” for these features, context assist, indeed, does a fair job in many cases.

    But what I personally will find helpful:

    – Generate delegate methods/getters/setters to a subset of fields and methods of a field (for composition over inheritance this is relatively frequent step)

    – Extract interface from a class (may be also extract mixin from a class for TS>=2.2)

    – Regarding “Typescript getters/setters/ generation doesn’t make sence” I’m not sure I understand. Generating accessors from a field makes the same sense in TS as in any other class field supporting language and more so in TS, where accessors are a part of the language spec. You say you are working exactly on that, generating of scaffolded get/set method in content assist, so I’m not sure how it doesn’t make sense : )

    In addition to quick set/get code generation it would be nice also to modify the field and other options. For example, in FlashDeveloper for ActionScript, which is very similar to TypeScript regarding fields and accessors, there is a wizard for selected field that optionally renames selected field x to _x, optionally makes it private and generates get and/or set x() accessors for _x. Though I’m not a big fan of modal wizards, probably few choices for generation in context assist will make more sense.
    The most basic use case is refactoring existing code, there are many scenarios when one will want to replace an existing public field by accessor code (e.g. replacing a field by delegate while keeping interface, conditional defaults, etc.).

    Less critical features but nice to have:

    Implement interface – seems working now using quick fix, cool! Would be nice to add also an option to selecting only subset and selecting what is implemented as readonly or getter/setter. Agree this is low priority.

    Override methods of base class at least on context assist level would be nice. Though not a pain for me, less base class encouragement the better, low priority. Note now content assist in this regard looks like a nonsense when pressing CTRL+SPACE inside a class – there are no base class methods in the list but an infinite pile of class-unrelated functions like onmouseover.

    #520934 Reply

    support-piotr
    Participant

    Fedor,

    Thank you for the details. We will keep in mind your suggestions when planning feature development.

    Best regards,
    Piotr Tomiak

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: No Generate for TS classes

You must be logged in to post in the forum log in