Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] Re: the new folding code: constantly layouting?

for js without the patch (i committed it now)
if i have a function like this:


/**
 * some js doc that is collapsed
 */
function myFunction()
{
   test = 10;

   // comment line 1 (collapse as one thing)
   // comment line 2 (collapse as one thing)
   // comment line 3 (collapse as one thing)

   test = 10

   // if you now start typing and doing stuff here, then you see the comment above expanding and collapsing again. How bigger collapsed comments in function how more noticable
}

johan

On Wed, Mar 11, 2009 at 14:07, Alex Panchenko <alex@xxxxxxxxx> wrote:
Hi all,

I would like to participate in the this folding discussion, but unfortunately I don't see nothing strange during redraws. With or without the patch.
What exactly should be done so redraws are noticeable?

Btw, I am on windows, my CPU is Intel Core Duo 1.80GHz

Regards,
Alex

----- Original Message -----
From: "Jae Gangemi" <jgangemi@xxxxxxxxx>
To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
Sent: Wednesday, March 11, 2009 6:21:57 PM GMT +06:00 Almaty, Novosibirsk
Subject: Re: [Dltk-dev] Re: the new folding code: constantly layouting?


this patch doesn't seem to have any effect for me - i'm still seeing the layout be redrawn every time the editor is reconciled, either via an explicit save or when i stop typing. it also looks like the python plugin is still having the same issue as well, so there may be more then one cause behind this.

i'll have to find some time to investigate further. if anyone has any other thoughts, let me know.


On Wed, Mar 11, 2009 at 5:55 AM, Johan Compagner < jcompagner@xxxxxxxxx > wrote:


any objections against this patch?
If not i will commit it today, if others can then quickly test if this breaks something in there folding or not.
As far as i can see everything works fine for JS







On Tue, Mar 10, 2009 at 21:52, Johan Compagner < jcompagner@xxxxxxxxx > wrote:


ok this patch:

### Eclipse Workspace Patch 1.0
#P org.eclipse.dltk.ui
Index: src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.dltk/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java,v
retrieving revision 1.31
diff -u -r1.31 AbstractASTFoldingStructureProvider.java
--- src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java 28 Feb 2009 18:24:08 -0000 1.31
+++ src/org/eclipse/dltk/ui/text/folding/AbstractASTFoldingStructureProvider.java 10 Mar 2009 20:37:51 -0000
@@ -184,7 +184,7 @@
public boolean equals(Object obj) {
if (obj instanceof SourceRangeStamp) {
SourceRangeStamp s = (SourceRangeStamp) obj;
- return (s.hash == hash && s.length == length);
+ return (s.hash == hash); // && s.length == length);
}
return super.equals(obj);
}
@@ -842,6 +842,7 @@

if (codeBlock.statement instanceof MethodDeclaration) {
MethodDeclaration meth = (MethodDeclaration) codeBlock.statement;
+ hash = meth.getName().hashCode();
element = methodCollector.get(meth
.getNameStart(), meth.getNameEnd()
- meth.getNameStart());


works for me in js.

The problem is this, _javascript_ also has method folding and comment folding
If i type in a method (which is pretty normal :) )

Then the hash of the SourceRangeStamp is constantly changing for that specific method
And that will result in a SourceRangeStamp that is completely different from the previous version

That will result in a remove and an addition instead of maybe just an update?

So what i changed was that for a method declaration i take the hashcode of the name instead of the hash of the content of the method which is constantly changing.
And i changed the equals of the sourcerange to only use the hash instead of also the lenght (because that would again result in a no hit that should be a hit)

Now what i get is just that many annotations are just updated instead of a removals and additions

for the js editor i cant find anything that doesnt work with this patch

johan






On Tue, Mar 10, 2009 at 16:08, Jae Gangemi < jgangemi@xxxxxxxxx > wrote:



ok - this is fixed. basically i forgot to add the necessary parts to fold /** */. :)





On Tue, Mar 10, 2009 at 10:24 AM, Jae Gangemi < jgangemi@xxxxxxxxx > wrote:



i know why the _javascript_ /** */ isn't folding, i'll explain in a few minutes.

great find - i'm having the same problem in my plugin (and the python one) - i don't seem to notice it in the tcl or ruby plugins, so perhaps something in their impls is different.





On Tue, Mar 10, 2009 at 10:18 AM, Johan Compagner < jcompagner@xxxxxxxxx > wrote:





if i comment out a line from class: AbstractASTFoldingStructureProvider

then the flickering is gone :


private class ElementChangedListener implements IElementChangedListener {
/*
* @see
* org.eclipse.dltk.core.IElementChangedListener#elementChanged(org.
* eclipse.dltk.core.ElementChangedEvent)
*/
public void elementChanged(ElementChangedEvent e) {
IModelElementDelta delta = findElement(fInput, e.getDelta());
if (delta != null
&& (delta.getFlags() & (IModelElementDelta.F_CONTENT | IModelElementDelta.F_CHILDREN)) != 0) {
// update(createContext(false)); <<<<<<<<<<<<<<<
}
}


Ofcourse new comment area's i create then are not updated as folding blocks (need to reopen the editor)
But somewhere in that code is the culprit

johan





On Tue, Mar 10, 2009 at 14:53, Johan Compagner < jcompagner@xxxxxxxxx > wrote:


Hi,

in js the new folding code doesnt work quite right.

if i have 3 comment lines like this:

// test 1
// test 2
// test 3

and i fold them then if i type below them. like copy paste or create a new line i see the editor redrawing itself
and my line where i am on (thats below the 3 lines above) looks quickly to be 2 lines below it where it is and then jumps back
This is very fast but very noticeable :(

It seems that the editor expands the comments when i am typing and then collapses it again.

Could be that this is only a js problem, there is also another problem with js and that is that header comments are not matched
I guess this is because in our case headers comments are always js doc (/** xxx */) and not just comments (// xxx )
I will investigate this if i can map it a bit better.

johan


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




--
-jae



--
-jae

_______________________________________________
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
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


Back to the top