Skip to content

Commit

Permalink
Fix Intellij Bug - make IElementType static in parser. (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
wilmveel authored Apr 4, 2024
1 parent 43495f0 commit 9d37650
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/lsp/intellij-plugin/src/main/kotlin/Parser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import com.intellij.psi.tree.TokenSet as IntellijTokenSet

class Parser : PsiParser {

class TypeDef : IElementType("TYPE_DEF", Language.INSTANCE)
class EndpointDef : IElementType("ENDPOINT_DEF", Language.INSTANCE)
class CustomTypeDef : IElementType("CUSTOM_TYPE_DEF", Language.INSTANCE)
class CustomTypeRef : IElementType("CUSTOM_TYPE_REF", Language.INSTANCE)
class Body : IElementType("BODY", Language.INSTANCE)
object TypeDef : IElementType("TYPE_DEF", Language.INSTANCE)
object EndpointDef : IElementType("ENDPOINT_DEF", Language.INSTANCE)
object CustomTypeDef : IElementType("CUSTOM_TYPE_DEF", Language.INSTANCE)
object CustomTypeRef : IElementType("CUSTOM_TYPE_REF", Language.INSTANCE)
object Body : IElementType("BODY", Language.INSTANCE)


override fun parse(root: IElementType, builder: PsiBuilder): ASTNode {
Expand All @@ -46,7 +46,7 @@ class Parser : PsiParser {
builder.tokenType == CUSTOM_TYPE -> {
val customTypeMarker = builder.mark()
builder.advanceLexer()
customTypeMarker.done(CustomTypeRef())
customTypeMarker.done(CustomTypeRef)
parseBody()
}

Expand All @@ -64,15 +64,15 @@ class Parser : PsiParser {
builder.tokenType == CUSTOM_TYPE -> {
val customTypeMarker = builder.mark()
builder.advanceLexer()
customTypeMarker.done(CustomTypeRef())
customTypeMarker.done(CustomTypeRef)
parseRef()
}

builder.tokenType == LEFT_CURLY -> {
val bodyMarker = builder.mark()
builder.advanceLexer()
parseBody()
bodyMarker.done(Body())
bodyMarker.done(Body)
builder.advanceLexer()
parseRef()
}
Expand All @@ -91,7 +91,7 @@ class Parser : PsiParser {
builder.tokenType == CUSTOM_TYPE -> {
val customTypeMarker = builder.mark()
builder.advanceLexer()
customTypeMarker.done(CustomTypeDef())
customTypeMarker.done(CustomTypeDef)
parseRef()
}

Expand All @@ -109,7 +109,7 @@ class Parser : PsiParser {
val marker = builder.mark()
builder.advanceLexer()
parseDef()
marker.done(TypeDef())
marker.done(TypeDef)
parse()
}

Expand Down

0 comments on commit 9d37650

Please sign in to comment.