From 393392bdaf1f4d44dfe970698acc055057a3053e Mon Sep 17 00:00:00 2001 From: "Alexander.Podkhalyuzin" Date: Sat, 23 Jul 2016 13:25:46 +0300 Subject: [PATCH 1/2] Removed unnecessary parentheses. --- .../plugins/scala/worksheet/WorksheetFoldingBuilder.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/jetbrains/plugins/scala/worksheet/WorksheetFoldingBuilder.scala b/src/org/jetbrains/plugins/scala/worksheet/WorksheetFoldingBuilder.scala index 0ea08743f6d..099235cf9b4 100644 --- a/src/org/jetbrains/plugins/scala/worksheet/WorksheetFoldingBuilder.scala +++ b/src/org/jetbrains/plugins/scala/worksheet/WorksheetFoldingBuilder.scala @@ -55,9 +55,9 @@ class WorksheetFoldingBuilder extends FoldingBuilder { (node.getText.startsWith(WorksheetFoldingBuilder.FIRST_LINE_PREFIX) || node.getText.startsWith(WorksheetFoldingBuilder.LINE_PREFIX))) { val length = Math.max(WorksheetFoldingBuilder.FIRST_LINE_PREFIX.length, WorksheetFoldingBuilder.LINE_PREFIX.length) - descriptors += (new FoldingDescriptor(node, + descriptors += new FoldingDescriptor(node, new TextRange(node.getPsi.asInstanceOf[PsiComment].getTextRange.getStartOffset, - node.getPsi.asInstanceOf[PsiComment].getTextRange.getStartOffset + length), null, Collections.emptySet[AnyRef], true)) + node.getPsi.asInstanceOf[PsiComment].getTextRange.getStartOffset + length), null, Collections.emptySet[AnyRef], true) } for (child <- node.getChildren(null)) { From ae74fbd221f319946c1cea950c739d4e14f2e65d Mon Sep 17 00:00:00 2001 From: "Alexander.Podkhalyuzin" Date: Mon, 25 Jul 2016 16:39:21 +0300 Subject: [PATCH 2/2] Fixed access to --- .../psi/api/statements/ScAnnotationsHolder.scala | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/org/jetbrains/plugins/scala/lang/psi/api/statements/ScAnnotationsHolder.scala b/src/org/jetbrains/plugins/scala/lang/psi/api/statements/ScAnnotationsHolder.scala index 6fadb2de4b6..5b8941183d6 100644 --- a/src/org/jetbrains/plugins/scala/lang/psi/api/statements/ScAnnotationsHolder.scala +++ b/src/org/jetbrains/plugins/scala/lang/psi/api/statements/ScAnnotationsHolder.scala @@ -34,15 +34,14 @@ trait ScAnnotationsHolder extends ScalaPsiElement with PsiAnnotationOwner { case _ => None } - val maybeStubAnnotations = maybeStub.toSeq flatMap { - _.getChildrenByType(TokenSet.create(ScalaElementTypes.ANNOTATIONS), - JavaArrayFactoryUtil.ScAnnotationsFactory).toSeq - } headOption + val maybeStubAnnotations = maybeStub.toSeq.flatMap({ + _.getChildrenByType(TokenSet.create(ScalaElementTypes.ANNOTATIONS), + JavaArrayFactoryUtil.ScAnnotationsFactory).toSeq + }).headOption - val maybeAnnotations = (maybeStubAnnotations ++ - Option(findChildByClassScala(classOf[ScAnnotations]))) headOption + val maybeAnnotations = maybeStubAnnotations.orElse(Option(findChildByClassScala(classOf[ScAnnotations]))) - maybeAnnotations.toSeq flatMap { + maybeAnnotations.toSeq.flatMap { _.getAnnotations.toSeq } }