Everlaw / nbts

NetBeans TypeScript editor plugin
283 stars 46 forks source link

Support for <editor-fold> tag #27

Closed timautin closed 8 years ago

timautin commented 8 years ago

I'm not sure if this is a Netbeans bug or if this is something the plugin should / could handle. In some languages (eg Java), Netbeans offers the possibility to add code regions, with the tag. For example:

// <editor-fold desc="GUI events">

... some code

// </editor-fold>

Then this code region can be folded (like functions can). But this doesn't work with nbts. Can you tell me if this is the plugin's role to handle that, or if I have to fill a bug to the Netbeans team? Thanks!

jeffrey-easyesi commented 8 years ago

Implemented in v1.7.5.0

timautin commented 8 years ago

Thanks for your reactivity, but doesn't seem to work (same behaviour as before the update). Is there something special to do to make it works?

Example of a non-working code:

import { ElementRef } from 'angular2/angular2'

export class Widget {

    // -------------------------------------------------------------------------
    // <editor-fold desc="Attributes">

    protected m_element: ElementRef;

    // </editor-fold>
    // -------------------------------------------------------------------------

    // -------------------------------------------------------------------------
    // <editor-fold desc="Constructor">

    constructor(_element: ElementRef) {

        this.m_element = _element;
    }

    // </editor-fold>
    // -------------------------------------------------------------------------
}
jeffrey-easyesi commented 8 years ago

Looks like TypeScript's folding of multiple consecutive // comments immediately before a declaration is interfering.

timautin commented 8 years ago

I'm not sure, this doesn't work either:

import { ElementRef } from 'angular2/angular2'

export class Widget {

    // <editor-fold desc="Attributes">

    protected m_element: ElementRef;

    // </editor-fold>

    // <editor-fold desc="Constructor">

    constructor(_element: ElementRef) {

        this.m_element = _element;
    }

    // </editor-fold>
}
timautin commented 8 years ago

But indeed, this is working:

import { ElementRef } from 'angular2/angular2'

export class Widget {

    // <editor-fold desc="Attributes">

    protected m_element: ElementRef;

    // </editor-fold>
}

Will you work on a fix?

jeffrey-easyesi commented 8 years ago

Workaround implemented in v1.7.5.1. Your example should now fold properly (with or without the // ------ comments)

timautin commented 8 years ago

This time it's working, thanks!!