[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [Dltk-dev] Re: the new folding code: constantly layouting?
|
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.
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