Skip to content

Commit

Permalink
chore: comments for parsing tests setup added
Browse files Browse the repository at this point in the history
  • Loading branch information
iromeo committed Apr 12, 2020
1 parent 0a439dd commit d1493c1
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.intellij.lang.LanguageASTFactory
import com.intellij.psi.PsiFile
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.testFramework.ParsingTestCase
import com.intellij.testFramework.TestApplicationManager
import com.jetbrains.python.*
import com.jetbrains.python.psi.LanguageLevel
import com.jetbrains.python.psi.PyFunction
Expand All @@ -27,11 +28,19 @@ class SnakemakeParsingTest : ParsingTestCase(

override fun setUp() {
super.setUp()

// W/O this call we get `java.lang.NoClassDefFoundError: Could not initialize class com.jetbrains.python.PythonDialectsTokenSetProvider`
// locally (macos)
TestApplicationManager.getInstance()

// w/o this cannot instantiate SnakemakeLexer
registerExtensionPoint(PythonDialectsTokenSetContributor.EP_NAME, PythonDialectsTokenSetContributor::class.java)
registerExtension(PythonDialectsTokenSetContributor.EP_NAME, PythonTokenSetContributor())
registerExtension(PythonDialectsTokenSetContributor.EP_NAME, SmkTokenSetContributor())
addExplicitExtension<ASTFactory>(LanguageASTFactory.INSTANCE, PythonLanguage.getInstance(), PythonASTFactory())
PythonDialectsTokenSetProvider.reset()

// w/o this fails due to NPEs on PyPsiFacade access
project.registerService(
PyPsiFacade::class.java,
PyPsiFacadeImpl::class.java
Expand Down

0 comments on commit d1493c1

Please sign in to comment.