Repository: intellij-rust/intellij-rust
Issue: NoClassDefFoundError: com/intellij/psi/util/PsiTreeUtilKt

## Problem description

I updated the plugin today, and it seems to have broken. The syntax highlighting usually won't work, and no code intentions are available. I think this is related to issue #2597 which seems to describe the same problem.

The following error appears in the log:

```
2018-08-07 03:04:42,588 [9260779]  ERROR - aemon.impl.PassExecutorService - CLion 2018.2  Build #CL-182.3684.76 
2018-08-07 03:04:42,588 [9260779]  ERROR - aemon.impl.PassExecutorService - JDK: 1.8.0_152-release 
2018-08-07 03:04:42,588 [9260779]  ERROR - aemon.impl.PassExecutorService - VM: OpenJDK 64-Bit Server VM 
2018-08-07 03:04:42,588 [9260779]  ERROR - aemon.impl.PassExecutorService - Vendor: JetBrains s.r.o 
2018-08-07 03:04:42,588 [9260779]  ERROR - aemon.impl.PassExecutorService - OS: Windows 10 
2018-08-07 03:04:42,588 [9260779]  ERROR - aemon.impl.PassExecutorService - Last Action: ShowSettings 
2018-08-07 03:04:42,993 [9261184]  ERROR - aemon.impl.PassExecutorService - com/intellij/psi/util/PsiTreeUtilKt 
java.lang.NoClassDefFoundError: com/intellij/psi/util/PsiTreeUtilKt
	at org.rust.ide.intentions.RsShowMacroExpansionIntentionBase.findApplicableContext(RsShowMacroExpansionIntentions.kt:54)
	at org.rust.ide.intentions.RsShowMacroExpansionIntentionBase.findApplicableContext(RsShowMacroExpansionIntentions.kt:18)
	at org.rust.ide.intentions.RsElementBaseIntentionAction.isAvailable(RsElementBaseIntentionAction.kt:54)
	at com.intellij.codeInsight.intention.BaseElementAtCaretIntentionAction.isAvailable(BaseElementAtCaretIntentionAction.java:41)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.availableFor(ShowIntentionActionsHandler.java:121)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.a(ShowIntentionsPass.java:318)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.chooseBetweenHostAndInjected(ShowIntentionActionsHandler.java:146)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getActionsToShow(ShowIntentionsPass.java:316)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getActionsToShow(ShowIntentionsPass.java:288)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doCollectInformation(ShowIntentionsPass.java:242)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:69)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.e(PassExecutorService.java:423)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1151)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.b(PassExecutorService.java:416)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:580)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.d(PassExecutorService.java:415)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.c(PassExecutorService.java:391)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:147)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:218)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:389)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:161)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
```

Full log: https://gist.github.com/Seeker14491/b7694cb05ceaf0680062f8157332c5d6

## Environment

* **Intellij-Rust plugin version:** 0.2.0.2102-182
* **Rust toolchain version:** rustc 1.30.0-nightly (3edb355b7 2018-08-03)
* **IDE name and version:** CLion 2018.2
* **Operating system:** Windows 10


Changed files:
src/main/kotlin/org/rust/ide/intentions/RsShowMacroExpansionIntentions.kt
src/main/kotlin/org/rust/ide/actions/macroExpansion/RsShowMacroExpansionActions.kt

diff --git a/src/main/kotlin/org/rust/ide/actions/macroExpansion/RsShowMacroExpansionActions.kt b/src/main/kotlin/org/rust/ide/actions/macroExpansion/RsShowMacroExpansionActions.kt
index b6f2c5e2d..a553173c2 100644
--- a/src/main/kotlin/org/rust/ide/actions/macroExpansion/RsShowMacroExpansionActions.kt
+++ b/src/main/kotlin/org/rust/ide/actions/macroExpansion/RsShowMacroExpansionActions.kt
@@ -14,8 +14,8 @@ import com.intellij.openapi.editor.Editor
 import com.intellij.openapi.project.Project
 import com.intellij.psi.PsiElement
 import com.intellij.psi.PsiFile
-import com.intellij.psi.util.parentOfType
 import org.rust.lang.core.psi.RsMacroCall
+import org.rust.lang.core.psi.ext.ancestorOrSelf
 
 abstract class RsShowMacroExpansionActionBase(private val expandRecursively: Boolean) : AnAction() {
 
@@ -59,7 +59,7 @@ class RsShowSingleStepMacroExpansionAction : RsShowMacroExpansionActionBase(expa
 fun getMacroUnderCaret(event: DataContext): RsMacroCall? {
     val elementUnderCaret = event.elementUnderCaretInEditor ?: return null
 
-    return elementUnderCaret.parentOfType<RsMacroCall>()
+    return elementUnderCaret.ancestorOrSelf()
 }
 
 private val DataContext.psiFile: PsiFile?
diff --git a/src/main/kotlin/org/rust/ide/intentions/RsShowMacroExpansionIntentions.kt b/src/main/kotlin/org/rust/ide/intentions/RsShowMacroExpansionIntentions.kt
index 018ff1753..342433a9f 100644
--- a/src/main/kotlin/org/rust/ide/intentions/RsShowMacroExpansionIntentions.kt
+++ b/src/main/kotlin/org/rust/ide/intentions/RsShowMacroExpansionIntentions.kt
@@ -9,11 +9,11 @@ import com.google.common.annotations.VisibleForTesting
 import com.intellij.openapi.editor.Editor
 import com.intellij.openapi.project.Project
 import com.intellij.psi.PsiElement
-import com.intellij.psi.util.parentOfType
 import org.rust.ide.actions.macroExpansion.MacroExpansionViewDetails
 import org.rust.ide.actions.macroExpansion.expandMacroForViewWithProgress
 import org.rust.ide.actions.macroExpansion.showMacroExpansionPopup
 import org.rust.lang.core.psi.RsMacroCall
+import org.rust.lang.core.psi.ext.ancestorOrSelf
 
 abstract class RsShowMacroExpansionIntentionBase(private val expandRecursively: Boolean) :
     RsElementBaseIntentionAction<RsMacroCall>() {
@@ -21,7 +21,7 @@ abstract class RsShowMacroExpansionIntentionBase(private val expandRecursively:
     override fun getFamilyName() = text
 
     override fun findApplicableContext(project: Project, editor: Editor, element: PsiElement): RsMacroCall? =
-        element.parentOfType<RsMacroCall>()
+        element.ancestorOrSelf()
 
     override fun invoke(project: Project, editor: Editor, ctx: RsMacroCall) {
         val expansionDetails = expandMacroForViewWithProgress(project, ctx, expandRecursively)