[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 
Re: [Dltk-dev] DLTK folding behavior
 | 
What about this?
ScriptEditor.java:
protected IFoldingStructureProvider getFoldingStructureProvider() {
  if (foldingStructureProvider == null) {
    foldingStructureProvider = new MyFoldingStructureProvider(this);
  }
  return foldingStructureProvider;
}
MyFoldingStructureProvider.java:
    private ScriptEditor fEditor;        
    protected CodeBlock[] getCodeBlocks(String code, int offset) {
        ISourceModule sourceModule = (ISourceModule) fEditor.getInputModelElement();
        ModuleDeclaration decl = AntlrSourceElementParser.parseModule(sourceModule); 
        FoldingASTVisitor visitor = getFoldingVisitor(offset);
        ...
    }  
On Thu, Apr 3, 2008 at 11:04 AM, Jae Gangemi <
jgangemi@xxxxxxxxx> wrote:
  +1 - this would be help with performance and eliminate an extra round trip to the parser.
  if you can find a way to get access to the ISourceModule object that represents the module open in the editor, you can call:
    SourceParserUtil.(ISourceModule module, IProblemReporter reporter)
  passing null for the reporter. it will handle checking the cache for you.    
On Thu, Apr 3, 2008 at 9:33 AM, Edgar Espina <
espina.edgar@xxxxxxxxx> wrote:
Hi Andrei,
I'll do.
Another improve that it could be great is:
AbstractASTFoldingStructureProvider.java
protected CodeBlock[] getCodeBlocks(String code, int offset) {
        ISourceParser parser = getSourceParser();
        ModuleDeclaration decl = parser.parse(null, code.toCharArray(), null);
        FoldingASTVisitor visitor = getFoldingVisitor(offset);
        .....
}
I think that this code colud be replaced for this one:
protected CodeBlock[] getCodeBlocks(String code, int offset) {
      ModuleDeclaration decl =  SourceParseUtil.getModuleFromCache(mifo) ;
      FoldingASTVisitor visitor = getFoldingVisitor(offset);
      .....
}
What do you think?
It is possible ?
How can I get ISourceModuleInfo?
BR
EdgarOn Wed, Apr 2, 2008 at 6:20 AM, Andrei Sobolev <
andrei.sobolev@xxxxxxxxx> wrote:
Hi Edgar,
I suppose this is a bug.
Also I found, what sometimes it works as expected not only for comments.
Could you please create bug report at Eclipse DLTK bug tracker.
Thanks,
Andrei Sobolev.
> Hi all
>
>  I have more than one folded region and when I make a change outside
> this region all regions are expanded
>  except the "comment region".
>
>  Is it possible that others regions have the same behavior that
> "comment region"?
>
> Thanks!
>
> 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
 
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev
  -- 
-jae
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev