Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala Hover API and fixes #816

Merged
merged 4 commits into from Oct 6, 2014
Merged

Conversation

dragos
Copy link
Member

@dragos dragos commented Oct 2, 2014

Based on #812.

  • fixed performance of hovers (scaladoc build lazily, and after retrieving errors)
  • fixed deadlock in quickfixes (hidden by timeout)
  • moved more types to public editor API.

@dragos
Copy link
Member Author

dragos commented Oct 3, 2014

I fixed the two issues noted by @skyluc

@ghprb-bot
Copy link

Test PASSed.

See Console Output in the link below for an update site containing this PR binary artefacts.

Refer to this link for build results: https://jenkins.scala-ide.org:8496/jenkins/job/ghprb-scala-ide-validator/1183/

@skyluc
Copy link
Member

skyluc commented Oct 6, 2014

LGTM, except for the problem in the play template editor, where the hover sometime displays the information from the wrong offset, when a file is dirty. Not a blocker for me.

htmlContents(header, comment)
}.getOption()
val htmlOutput = rawOutput map {(comm) => createHtmlOutput {(sb) => sb append comm }}
val javaElement = getJavaElement(sym, javaProject)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the getJavaElement call faster is indeed the whole reason this was taking a javaProject as an argument, and it's true this call is unneeded for Scala code (we could pass null there in fact). But I'm wary about the effect removing this line for hovers on java term Haven't managed to break anything so far, though.

@huitseeker
Copy link
Member

Works fine on Java elements (!). LGTM

@ghprb-bot
Copy link

Test PASSed.

See Console Output in the link below for an update site containing this PR binary artefacts.

Refer to this link for build results: https://jenkins.scala-ide.org:8496/jenkins/job/ghprb-scala-ide-validator/1191/

@dragos
Copy link
Member Author

dragos commented Oct 6, 2014

Ok, I'll merge this, trigger a nightly and wait for plugins to build

dragos added a commit that referenced this pull request Oct 6, 2014
@dragos dragos merged commit cb095e4 into scala-ide:master Oct 6, 2014
@skyluc
Copy link
Member

skyluc commented Oct 6, 2014

I get some InterruptedException if I type characters while I'm waiting for a hover.

It seems easier to reproduce in the Play Template editor, but I got it also in the Scala Editor. I'm using collection.immutable.List.map as hover target in my tests.
It might be a normal exception. In that case we should catch it.

!ENTRY org.scala-ide.sdt.core 4 0 2014-10-06 18:23:39.114
!MESSAGE Error during askOption
!STACK 0
java.lang.InterruptedException
    at java.lang.Object.wait(Native Method)
    at scala.tools.nsc.interactive.Response.get(Response.scala:77)
    at org.scalaide.core.compiler.IScalaPresentationCompiler$Implicits$RichResponse$.getOption$extension(IScalaPresentationCompiler.scala:320)
    at org.scalaide.ui.internal.editor.hover.ScalaHoverImpl$$anonfun$1$$anonfun$apply$3.typeMessage$1(ScalaHoverImpl.scala:148)
    at org.scalaide.ui.internal.editor.hover.ScalaHoverImpl$$anonfun$1$$anonfun$apply$3.apply(ScalaHoverImpl.scala:245)
    at org.scalaide.ui.internal.editor.hover.ScalaHoverImpl$$anonfun$1$$anonfun$apply$3.apply(ScalaHoverImpl.scala:111)
    at org.scalaide.core.compiler.InteractiveCompilationUnit$$anonfun$withSourceFile$1.apply(InteractiveCompilationUnit.scala:203)
    at org.scalaide.core.compiler.InteractiveCompilationUnit$$anonfun$withSourceFile$1.apply(InteractiveCompilationUnit.scala:203)
    at org.scalaide.core.internal.compiler.PresentationCompilerProxy$$anonfun$internal$1.apply(PresentationCompilerProxy.scala:102)
    at org.scalaide.core.internal.compiler.PresentationCompilerProxy$$anonfun$internal$1.apply(PresentationCompilerProxy.scala:101)
    at scala.Option.flatMap(Option.scala:170)
    at org.scalaide.core.internal.compiler.PresentationCompilerProxy.internal(PresentationCompilerProxy.scala:101)
    at org.scalaide.core.internal.compiler.PresentationCompilerProxy.apply(PresentationCompilerProxy.scala:59)
    at org.scalaide.core.compiler.InteractiveCompilationUnit$class.withSourceFile(InteractiveCompilationUnit.scala:203)
    at org.scalaide.ui.editor.CompilationUnit.withSourceFile(CompilationUnit.scala:10)
    at org.scalaide.ui.internal.editor.hover.ScalaHoverImpl$$anonfun$1.apply(ScalaHoverImpl.scala:111)
    at org.scalaide.ui.internal.editor.hover.ScalaHoverImpl$$anonfun$1.apply(ScalaHoverImpl.scala:109)
    at scala.Option.map(Option.scala:145)
    at org.scalaide.ui.internal.editor.hover.ScalaHoverImpl.getHoverInfo2(ScalaHoverImpl.scala:109)
    at org.eclipse.wst.sse.ui.internal.taginfo.BestMatchHover.getHoverInfo2(BestMatchHover.java:139)
    at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:166)

@dragos
Copy link
Member Author

dragos commented Oct 6, 2014

I've seen this as well... I think it's the hover computer that interrupts the thread if the user starts typing or moves the cursor. I could add another try-catch in ScalaHover.

Edit: I don't think this is new to this PR, but annoying nonetheless

@huitseeker
Copy link
Member

It was there before the PR : long requests on inherited, or far-away (for some sense) scaladoc get regularily interrupted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants