Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] DelegatingFoldingStructure and IFoldingBlockProvider

Hi Edgar,

I've reproduced the NPE, I'll will fix it.

Thank you,
Alex

----- Original Message -----
From: "Edgar Espina" <espina.edgar@xxxxxxxxx>
To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
Sent: Tuesday, July 13, 2010 8:26:04 PM GMT +06:00 Almaty, Novosibirsk
Subject: Re: [Dltk-dev] DelegatingFoldingStructure and IFoldingBlockProvider

These are the steps:
- Goto a collapsed region. Don't expanded it from the "+" button, just hit enter to expanded the region.
- Start typing some text inside the region.
- Press Ctrl+Save. At this point I got the NPE.

Let me know if you could reproduce it, if not I could take the full stacktrace and send it to you from where is it called (later today).

Thanks,

edgar

On Tue, Jul 13, 2010 at 10:09 AM, Alex Panchenko <alex@xxxxxxxxx> wrote:
You are right, IFoldingBlockKind usage is not documented. I assumed it would be implemented as enum:
enum FoldingBlockKind implements IFoldingBlockKind {
CLASS, FUNCTION, COMMENT;

public boolean isComment() {
return this == COMMENT;
}
}
that's why it is compared using ==.

Regarding NPE - do you know how to reproduce it / when does another thread appear?

Regards,
Alex

----- Original Message -----
From: "Edgar Espina" <espina.edgar@xxxxxxxxx>
To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
Sent: Tuesday, July 13, 2010 7:14:09 PM GMT +06:00 Almaty, Novosibirsk
Subject: Re: [Dltk-dev] DelegatingFoldingStructure and IFoldingBlockProvider

Hi Alex,
 I fixed 1 & 2 providing a singleton instances of IFoldingBlockKind, why is that? The equals implementation of DelegatingFoldingStructure.AnnotationKey check the identity of the "kind" object not the equality (kind == other.kind). It's OK for me, but it would be more sense if it check by equality.

The NPE is cause by another thread (as you say) the problem is that all they use the same IFoldingBlockProvider and all they are calling the IFoldingBlockProvider.setRequestor. I think we need:
  1) sync the access to the IFoldingBlockProvider.setRequestor && IFoldingBlockProvider.computeFoldableBlocks
  2) or create one instance of IFoldingBlockProvider per thread.

Thank you Alex,
 
edgar

On Tue, Jul 13, 2010 at 6:53 AM, Alex Panchenko <alex@xxxxxxxxx> wrote:
Hi Edgar,

DelegatingFoldingStructure is used in DLTK-_javascript_ Editor and a couple of other projects.

1 & 2 are basically the same issue.
To resolve you should report correct values for "IFoldingBlockKind kind, Object element" parameters - they are like the primary key of the region, so they should have correct equals() implementation, etc.

NPE is unexpected, it can occur only if code is executed in another thread. It is called by the reconciler, so the only assumption is that another reconciler is started somehow for the same editor.

Regards,
Alex


----- Original Message -----
From: "Edgar Espina" <espina.edgar@xxxxxxxxx>
To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
Sent: Monday, July 12, 2010 7:54:22 PM GMT +06:00 Almaty, Novosibirsk
Subject: [Dltk-dev] DelegatingFoldingStructure and IFoldingBlockProvider

Greetings,

 I'm writing some parts (actually all the code :D) from my ANTLR IDE. Starting with DLTK2.0 the AbstractASTFoldingStructureProvider class was deprecated in favor of DelegatingFoldingStructure and IFoldingBlockProvider which is good. The default implementation PartitionIdFoldingProvider does a great work integrating the folding regions with the already created partitions.
 I would like to know if anyone is using these new two classes, because I found three issues:
  1) The initial collapse could not be ensured. If I set the initial collapse to true, the folder's region start collapsed but after a few seconds their are expanded.
  2) It doesn't matter where the user start the editing all folded region will be expanded all the time.
  3) I found some NPE in the PartitionIdFoldingProvider#reportRegions method, but some unknown reason the "requestor" field is null. Unfortunately, I could not explain this behavior as far as I know the DelegatingFoldingStructure is the only class that calls to PartitionIdFoldingProvider's method I the execution flow seems to be OK (I could not see any new thread). I'll try to isolate and identify the specific issue here.

For 1) and 2) I remember this bugs were present in AbstractASTFoldingStructureProvider, but then all them were fixed. Could any one point me were to look for these issues?

Thanks in advance,
--
edgar

_______________________________________________ dltk-dev mailing list dltk-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/dltk-dev

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
edgar

_______________________________________________ dltk-dev mailing list dltk-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/dltk-dev

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev




--
edgar

_______________________________________________ dltk-dev mailing list dltk-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/dltk-dev

Back to the top