Skip to content

Commit

Permalink
Fix compatibility with 2021.1 EAP
Browse files Browse the repository at this point in the history
  • Loading branch information
AzureMarker committed Feb 14, 2021
1 parent 9f9ec45 commit 917abc3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ task generateParser(type: GenerateParser) {

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
// Test with 2020.3
version '2020.3'
plugins = ['PsiViewer:203-SNAPSHOT', 'org.rust.lang:0.3.136.3514-203', 'org.toml.lang:0.2.136.3514-203']
// Test with the latest EAP
version 'LATEST-EAP-SNAPSHOT'
plugins = ['PsiViewer:211-SNAPSHOT', 'org.rust.lang:0.3.140.3644-203', 'org.toml.lang:0.2.140.3644-203']
}
compileKotlin {
kotlinOptions {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/mdrobnak/lalrpop/psi/LpResolveType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiFileFactory
import com.intellij.psi.util.findDescendantOfType
import com.intellij.psi.util.PsiTreeUtil
import com.mdrobnak.lalrpop.psi.ext.rustGenericUnitStructs
import com.mdrobnak.lalrpop.psi.util.lalrpopTypeResolutionContext
import org.rust.lang.RsLanguage
Expand Down Expand Up @@ -116,7 +116,7 @@ fun String.lalrpopRustType(
for (child in file.childrenOfType<RsExpandedElement>())
child.setContext(modDefinition)

val tyAlias = file.findDescendantOfType<RsTypeAlias>() ?: return null
val tyAlias = PsiTreeUtil.findChildOfType(file, RsTypeAlias::class.java) ?: return null
val ty = tyAlias.typeReference?.type ?: return null
return ImplLookup.relativeTo(tyAlias).ctx.fullyResolve(ty)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package com.mdrobnak.lalrpop.psi.ext

import com.intellij.psi.PsiFile
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.psi.util.findDescendantOfType
import com.mdrobnak.lalrpop.psi.LpGrammarDecl

fun PsiFile.lalrpopFindGrammarDecl(): LpGrammarDecl = findDescendantOfType()!!
fun PsiFile.lalrpopFindGrammarDecl(): LpGrammarDecl = PsiTreeUtil.findChildOfType(this, LpGrammarDecl::class.java)!!

fun LpGrammarDecl.typeParamsRustUnitStructs(): String =
grammarTypeParams?.typeParamList?.filter { it.id != null }
Expand Down

0 comments on commit 917abc3

Please # to comment.