PsiViewer: weird behavior with comments

If I have PsiViewer 2.25.1 running with both 'Autoscroll From Source' and
'Autoscroll To Source' options enabled, editing an end-of-line comment and
waiting for a reparse sends my caret to the englobing block opening brace.

for example:

if (foobar) {
something(); // } add "hello", wait, and the caret jumps to: if (foobar) ]]>{
something(); // hello
}

pretty disturbing at first :)

Vince.


6 comments
Comment actions Permalink

Arrrrrrrrrrggggggggghhhhhhhhhhhhhhhhhhhh!

...ahhh, that's better...

Hi Vince,

Thanks for the feedback. I've found even more weirdness (on #3281 at least):

1. Selecting, say, a method in the tree view momentarily highlights the method (as you would expect) and then highlights the method name (as you would not expect) and adjusts the tree selection. Similar behaviour selecting other elements that have children.

2. "Scroll from source" still takes place even with the button toggled off.

I might have to rename the plugin to Whack-a-mole :)

Cheers,
A.

0
Comment actions Permalink

Fixed in 2.25.2.

I've changed it so that the plugin will never move the editor caret.

The "scroll to source" function will still scroll the editor so that the selected element is in view (and it will be hightlighted if the "highlight" button is checked), but it will not try to move the caret to the selected element.

Cheers,
A.

0
Comment actions Permalink

That works much better. I liked the caret moving according to the tree
selection, but I guess the highlighter works about just as well.

Thanks,

Vince.


0
Comment actions Permalink

Might have spoken too soon... :)

Assertion failed
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:64)
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:72)
at
com.intellij.psi.impl.source.IndexedRepositoryPsiElement.getIndex(IndexedRep
ositoryPsiElement.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at idea.util.IntrospectionUtil.getValue(IntrospectionUtil.java:66)
at
idea.plugin.psiviewer.view.PropertySheetPanel.setTarget(PropertySheetPanel.j
ava:66)
at
idea.plugin.psiviewer.view.PsiViewerPanel.updatePropertySheet(PsiViewerPanel
.java:299)
at
idea.plugin.psiviewer.view.PsiViewerPanel.setSelectedElement(PsiViewerPanel.
java:282)
at
idea.plugin.psiviewer.view.PsiViewerPanel.access$600(PsiViewerPanel.java:56)
at
idea.plugin.psiviewer.view.PsiViewerPanel$ViewerTreeSelectionListener.valueC
hanged(PsiViewerPanel.java:248)
at
javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(DefaultTreeSelec
tionModel.java:629)
at
javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(DefaultTreeSelec
tionModel.java:1076)
at
javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(DefaultTreeSele
ctionModel.java:287)
at
javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(DefaultTreeSelec
tionModel.java:170)
at javax.swing.JTree.setSelectionPath(JTree.java:1168)
at
idea.plugin.psiviewer.view.PsiViewerPanel.resetTree(PsiViewerPanel.java:131)
at
idea.plugin.psiviewer.view.PsiViewerPanel.showRootElement(PsiViewerPanel.jav
a:108)
at
idea.plugin.psiviewer.view.PsiViewerPanel.setRootElement(PsiViewerPanel.java
:352)
at
idea.plugin.psiviewer.view.PsiViewerPanel.selectRootElement(PsiViewerPanel.j
ava:97)
at
idea.plugin.psiviewer.view.PsiViewerPanel.refreshRootElement(PsiViewerPanel.
java:102)
at
idea.plugin.psiviewer.controller.project.EditorListener$2.actionPerformed(Ed
itorListener.java:148)
at javax.swing.Timer.fireActionPerformed(Timer.java:271)
at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at
com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:146)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:101)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:115)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:201)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

Vince.



0
Comment actions Permalink

Vince,

I believe this is yet another instance of a problem reported earlier (unrelated to the caret moving fix). The properties panel invokes all the 'getters' on the selected psi element. Unfortunately, not all of these are atomic - that is, they depend on other things and take exception (literally) to being invoked unexpectedly. I suppose I could catch the Throwables but I thought this was bad practice. What do you think?

Could you turn on debug logging so I can see which getter was being invoked?...or show me how to reproduce the problem?

Cheers,
A.

0
Comment actions Permalink

See if 2.25.3 fixes it for you.

Cheers,
A.

0

Please sign in to leave a comment.