From 2292500711a6ee135a8036092f0bcfd92571c533 Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Sat, 19 Oct 2024 23:34:37 +0300 Subject: [PATCH 01/11] fixed a bug in the project --- src/test/kotlin/com/vk/tlschema/lang/TLSchemaFileTypeTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/kotlin/com/vk/tlschema/lang/TLSchemaFileTypeTest.kt b/src/test/kotlin/com/vk/tlschema/lang/TLSchemaFileTypeTest.kt index 7065e7b..d2d6a03 100644 --- a/src/test/kotlin/com/vk/tlschema/lang/TLSchemaFileTypeTest.kt +++ b/src/test/kotlin/com/vk/tlschema/lang/TLSchemaFileTypeTest.kt @@ -4,7 +4,7 @@ import com.intellij.testFramework.fixtures.BasePlatformTestCase import com.vk.tlschema.TLSchemaFileType class TLSchemaFileTypeTest : BasePlatformTestCase() { - private val fileType = TLSchemaFileType.INSTANCE + private val fileType = TLSchemaFileType fun `test combined_tl file`() = toTest("combined.tl") From be09b9ee8fa0638c63e99d5c5ad44104bafa20d5 Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Sun, 18 Feb 2024 23:21:44 +0300 Subject: [PATCH 02/11] use to implement `mixin` methods --- src/main/grammars/TLSchema.bnf | 61 ++++++++++++++----- .../vk/tlschema/psi/TLSchemaNamedElement.java | 7 --- .../psi/impl/TLSchemaNamedElementImpl.java | 12 ---- .../tlschema/psi/TLSchemaDeclarationBase.kt | 5 ++ .../psi/TLSchemaDeclarationElement.kt | 15 +++++ .../com/vk/tlschema/psi/TLSchemaElement.kt | 5 ++ .../vk/tlschema/psi/TLSchemaNamedElement.kt | 19 ++++++ .../tlschema/psi/TLSchemaNamespacesElement.kt | 5 ++ .../TLSchemaConstructorDeclarationsMixin.kt | 12 ++++ .../psi/mixins/TLSchemaDeclarationMixin.kt | 45 ++++++++++++++ .../psi/mixins/TLSchemaElementMixin.kt | 7 +++ .../mixins/TLSchemaFunDeclarationsMixin.kt | 12 ++++ .../psi/mixins/TLSchemaLcIdentFullMixin.kt | 12 ++++ .../psi/mixins/TLSchemaLcIdentNsMixin.kt | 46 ++++++++++++++ .../psi/mixins/TLSchemaResultTypeMixin.kt | 12 ++++ .../psi/mixins/TLSchemaUcIdentNsMixin.kt | 46 ++++++++++++++ .../psi/mixins/TLSchemaVarIdentMixin.kt | 46 ++++++++++++++ 17 files changed, 333 insertions(+), 34 deletions(-) delete mode 100644 src/main/java/com/vk/tlschema/psi/TLSchemaNamedElement.java delete mode 100644 src/main/java/com/vk/tlschema/psi/impl/TLSchemaNamedElementImpl.java create mode 100644 src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationBase.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationElement.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/TLSchemaElement.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/TLSchemaNamedElement.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/TLSchemaNamespacesElement.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaConstructorDeclarationsMixin.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaElementMixin.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaFunDeclarationsMixin.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentFullMixin.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaResultTypeMixin.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt create mode 100644 src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt diff --git a/src/main/grammars/TLSchema.bnf b/src/main/grammars/TLSchema.bnf index 34fb509..b29b3de 100644 --- a/src/main/grammars/TLSchema.bnf +++ b/src/main/grammars/TLSchema.bnf @@ -16,7 +16,7 @@ } -TLShemaFile ::= constructor_declarations [ ((TRIPPLE_MINUS FUNCTIONS_KW TRIPPLE_MINUS fun_declarations) | (TRIPPLE_MINUS TYPES_KW TRIPPLE_MINUS constructor_declarations)) *] +TLSchemaFile ::= constructor_declarations [ ((TRIPPLE_MINUS FUNCTIONS_KW TRIPPLE_MINUS fun_declarations) | (TRIPPLE_MINUS TYPES_KW TRIPPLE_MINUS constructor_declarations)) *] comment_node ::= COMMENT @@ -26,20 +26,42 @@ lc_ident_node ::= LC_IDENT attribute_node ::= ATTRIBUTE; namespace_ident ::= LC_IDENT + lc_ident_ns ::= [ namespace_ident DOT ] lc_ident_node { - mixin="com.vk.tlschema.psi.impl.TLSchemaNamedElementImpl" - implements="com.vk.tlschema.psi.TLSchemaNamedElement" - methods=[getName setName getReference getReferences getPresentation getDeclaration]} + implements=[ + "com.vk.tlschema.psi.TLSchemaNamedElement" + "com.vk.tlschema.psi.TLSchemaDeclarationBase" + ] + mixin="com.vk.tlschema.psi.mixins.TLSchemaLcIdentNsMixin" +} + uc_ident_ns ::= [ namespace_ident DOT ] uc_ident_node { - mixin="com.vk.tlschema.psi.impl.TLSchemaNamedElementImpl" - implements="com.vk.tlschema.psi.TLSchemaNamedElement" - methods=[getName setName getReference getReferences getPresentation getDeclaration]} -lc_ident_full ::= lc_ident_ns [ SHARP_HEX_NUMBER ] {methods=[getDeclaration]} + implements=[ + "com.vk.tlschema.psi.TLSchemaNamedElement" + "com.vk.tlschema.psi.TLSchemaDeclarationBase" + ] + mixin="com.vk.tlschema.psi.mixins.TLSchemaUcIdentNsMixin" +} -constructor_declarations ::= [ declaration * ] {methods=[getNamespaces]} -fun_declarations ::= [ declaration * ] {methods=[getNamespaces]} +lc_ident_full ::= lc_ident_ns [ SHARP_HEX_NUMBER ] { + implements="com.vk.tlschema.psi.TLSchemaDeclarationBase" + mixin="com.vk.tlschema.psi.mixins.TLSchemaLcIdentFullMixin" +} + +constructor_declarations ::= [ declaration * ] { + implements="com.vk.tlschema.psi.TLSchemaNamespacesElement" + mixin="com.vk.tlschema.psi.mixins.TLSchemaConstructorDeclarationsMixin" +} -declaration ::= combinator_decl | combinator_decl_builtin {methods=[getCombinator getResultType getNumVars getTypeVars haveConditionalArgs getNamespace]} +fun_declarations ::= [ declaration * ] { + implements="com.vk.tlschema.psi.TLSchemaNamespacesElement" + mixin="com.vk.tlschema.psi.mixins.TLSchemaFunDeclarationsMixin" +} + +declaration ::= combinator_decl | combinator_decl_builtin { + implements="com.vk.tlschema.psi.TLSchemaDeclarationElement" + mixin="com.vk.tlschema.psi.mixins.TLSchemaDeclarationMixin" +} combinator_decl_builtin ::= combinator_decl_builtin_type; @@ -55,10 +77,15 @@ type_with_triangle_braces ::= type_ident LEQ type_expr [ (COMA type_expr) * ] GE percent_term ::= PERCENT term type_ident ::= boxed_type_ident | lc_ident_ns | SHARP boxed_type_ident ::= uc_ident_ns + var_ident ::= lc_ident_node | uc_ident_node { - mixin="com.vk.tlschema.psi.impl.TLSchemaNamedElementImpl" - implements="com.vk.tlschema.psi.TLSchemaNamedElement" - methods=[getName setName getReference getReferences getPresentation getDeclaration]} + implements=[ + "com.vk.tlschema.psi.TLSchemaNamedElement" + "com.vk.tlschema.psi.TLSchemaDeclarationBase" + ] + mixin="com.vk.tlschema.psi.mixins.TLSchemaVarIdentMixin" +} + type_term ::= term nat_term ::= nat_expr @@ -75,4 +102,8 @@ type_term_exc ::= type_term | EXCMARK type_term multiplicity ::= nat_term var_ident_opt ::= var_ident | UNDERSCORE conditional_def ::= var_ident [ DOT NAT_CONST ] QMARK -result_type ::= (boxed_type_ident LEQ type_expr [ (COMA type_expr ) * ] GEQ) | (boxed_type_ident [type_expr]) {methods=[getDeclaration]} \ No newline at end of file + +result_type ::= (boxed_type_ident LEQ type_expr [ (COMA type_expr ) * ] GEQ) | (boxed_type_ident [type_expr]) { + implements="com.vk.tlschema.psi.TLSchemaDeclarationBase" + mixin="com.vk.tlschema.psi.mixins.TLSchemaResultTypeMixin" +} diff --git a/src/main/java/com/vk/tlschema/psi/TLSchemaNamedElement.java b/src/main/java/com/vk/tlschema/psi/TLSchemaNamedElement.java deleted file mode 100644 index 6b8da0a..0000000 --- a/src/main/java/com/vk/tlschema/psi/TLSchemaNamedElement.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.vk.tlschema.psi; - -import com.intellij.navigation.NavigationItem; -import com.intellij.psi.PsiNamedElement; - -public interface TLSchemaNamedElement extends PsiNamedElement, NavigationItem { -} \ No newline at end of file diff --git a/src/main/java/com/vk/tlschema/psi/impl/TLSchemaNamedElementImpl.java b/src/main/java/com/vk/tlschema/psi/impl/TLSchemaNamedElementImpl.java deleted file mode 100644 index aa61cfe..0000000 --- a/src/main/java/com/vk/tlschema/psi/impl/TLSchemaNamedElementImpl.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.vk.tlschema.psi.impl; - -import com.intellij.extapi.psi.ASTWrapperPsiElement; -import com.intellij.lang.ASTNode; -import com.vk.tlschema.psi.TLSchemaNamedElement; -import org.jetbrains.annotations.NotNull; - -public abstract class TLSchemaNamedElementImpl extends ASTWrapperPsiElement implements TLSchemaNamedElement { - public TLSchemaNamedElementImpl(@NotNull ASTNode node) { - super(node); - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationBase.kt b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationBase.kt new file mode 100644 index 0000000..f1db6e1 --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationBase.kt @@ -0,0 +1,5 @@ +package com.vk.tlschema.psi + +interface TLSchemaDeclarationBase : TLSchemaElement { + fun getDeclaration(): TLSchemaDeclaration? +} diff --git a/src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationElement.kt b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationElement.kt new file mode 100644 index 0000000..811fb56 --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationElement.kt @@ -0,0 +1,15 @@ +package com.vk.tlschema.psi + +interface TLSchemaDeclarationElement : TLSchemaElement { + fun getCombinator(): TLSchemaLcIdentNs + + fun getResultType(): TLSchemaResultType + + fun getNumVars(): List + + fun getTypeVars(): List + + fun haveConditionalArgs(): Boolean + + fun getNamespace(): String +} diff --git a/src/main/kotlin/com/vk/tlschema/psi/TLSchemaElement.kt b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaElement.kt new file mode 100644 index 0000000..e546f1e --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaElement.kt @@ -0,0 +1,5 @@ +package com.vk.tlschema.psi + +import com.intellij.psi.PsiElement + +interface TLSchemaElement : PsiElement diff --git a/src/main/kotlin/com/vk/tlschema/psi/TLSchemaNamedElement.kt b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaNamedElement.kt new file mode 100644 index 0000000..f8ab8c3 --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaNamedElement.kt @@ -0,0 +1,19 @@ +package com.vk.tlschema.psi + +import com.intellij.navigation.ItemPresentation +import com.intellij.navigation.NavigationItem +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiNamedElement +import com.intellij.psi.PsiReference + +interface TLSchemaNamedElement : TLSchemaElement, PsiNamedElement, NavigationItem { + override fun getName(): String? + + override fun setName(newName: String): PsiElement + + override fun getReference(): PsiReference? + + override fun getReferences(): Array + + override fun getPresentation(): ItemPresentation? +} diff --git a/src/main/kotlin/com/vk/tlschema/psi/TLSchemaNamespacesElement.kt b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaNamespacesElement.kt new file mode 100644 index 0000000..04efd0c --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaNamespacesElement.kt @@ -0,0 +1,5 @@ +package com.vk.tlschema.psi + +interface TLSchemaNamespacesElement : TLSchemaElement { + fun getNamespaces(result: Set) +} diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaConstructorDeclarationsMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaConstructorDeclarationsMixin.kt new file mode 100644 index 0000000..6931693 --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaConstructorDeclarationsMixin.kt @@ -0,0 +1,12 @@ +package com.vk.tlschema.psi.mixins + +import com.intellij.lang.ASTNode +import com.vk.tlschema.psi.TLSchemaConstructorDeclarations +import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil + +internal abstract class TLSchemaConstructorDeclarationsMixin(node: ASTNode) : + TLSchemaElementMixin(node), TLSchemaConstructorDeclarations { + override fun getNamespaces(result: Set) { + TLSchemaPsiImplUtil.getNamespaces(this, result) + } +} diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt new file mode 100644 index 0000000..e0feb52 --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt @@ -0,0 +1,45 @@ +package com.vk.tlschema.psi.mixins + +import com.intellij.extapi.psi.ASTWrapperPsiElement +import com.intellij.lang.ASTNode +import com.vk.tlschema.psi.TLSchemaCombinatorDecl +import com.vk.tlschema.psi.TLSchemaCombinatorDeclBuiltin +import com.vk.tlschema.psi.TLSchemaDeclaration +import com.vk.tlschema.psi.TLSchemaLcIdentNs +import com.vk.tlschema.psi.TLSchemaResultType +import com.vk.tlschema.psi.TLSchemaVarIdent +import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil + +internal abstract class TLSchemaDeclarationMixin(node: ASTNode) : ASTWrapperPsiElement(node), TLSchemaDeclaration { + override fun getCombinatorDecl(): TLSchemaCombinatorDecl? { + return findChildByClass(TLSchemaCombinatorDecl::class.java) + } + + override fun getCombinatorDeclBuiltin(): TLSchemaCombinatorDeclBuiltin? { + return findChildByClass(TLSchemaCombinatorDeclBuiltin::class.java) + } + + override fun getCombinator(): TLSchemaLcIdentNs { + return TLSchemaPsiImplUtil.getCombinator(this) + } + + override fun getResultType(): TLSchemaResultType { + return TLSchemaPsiImplUtil.getResultType(this) + } + + override fun getNumVars(): MutableList { + return TLSchemaPsiImplUtil.getNumVars(this) + } + + override fun getTypeVars(): MutableList { + return TLSchemaPsiImplUtil.getTypeVars(this) + } + + override fun haveConditionalArgs(): Boolean { + return TLSchemaPsiImplUtil.haveConditionalArgs(this) + } + + override fun getNamespace(): String { + return TLSchemaPsiImplUtil.getNamespace(this) + } +} diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaElementMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaElementMixin.kt new file mode 100644 index 0000000..9a5f8ee --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaElementMixin.kt @@ -0,0 +1,7 @@ +package com.vk.tlschema.psi.mixins + +import com.intellij.extapi.psi.ASTWrapperPsiElement +import com.intellij.lang.ASTNode +import com.vk.tlschema.psi.TLSchemaElement + +internal abstract class TLSchemaElementMixin(node: ASTNode) : ASTWrapperPsiElement(node), TLSchemaElement diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaFunDeclarationsMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaFunDeclarationsMixin.kt new file mode 100644 index 0000000..ab304e9 --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaFunDeclarationsMixin.kt @@ -0,0 +1,12 @@ +package com.vk.tlschema.psi.mixins + +import com.intellij.lang.ASTNode +import com.vk.tlschema.psi.TLSchemaFunDeclarations +import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil + +internal abstract class TLSchemaFunDeclarationsMixin(node: ASTNode) : + TLSchemaElementMixin(node), TLSchemaFunDeclarations { + override fun getNamespaces(result: Set) { + TLSchemaPsiImplUtil.getNamespaces(this, result) + } +} diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentFullMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentFullMixin.kt new file mode 100644 index 0000000..4e94747 --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentFullMixin.kt @@ -0,0 +1,12 @@ +package com.vk.tlschema.psi.mixins + +import com.intellij.lang.ASTNode +import com.vk.tlschema.psi.TLSchemaDeclaration +import com.vk.tlschema.psi.TLSchemaLcIdentFull +import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil + +internal abstract class TLSchemaLcIdentFullMixin(node: ASTNode) : TLSchemaElementMixin(node), TLSchemaLcIdentFull { + override fun getDeclaration(): TLSchemaDeclaration? { + return TLSchemaPsiImplUtil.getDeclaration(this) + } +} diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt new file mode 100644 index 0000000..a3ba9b1 --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt @@ -0,0 +1,46 @@ +package com.vk.tlschema.psi.mixins + +import com.intellij.extapi.psi.ASTWrapperPsiElement +import com.intellij.lang.ASTNode +import com.intellij.navigation.ItemPresentation +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiReference +import com.vk.tlschema.psi.TLSchemaDeclaration +import com.vk.tlschema.psi.TLSchemaLcIdentNode +import com.vk.tlschema.psi.TLSchemaLcIdentNs +import com.vk.tlschema.psi.TLSchemaNamespaceIdent +import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil + +internal abstract class TLSchemaLcIdentNsMixin(node: ASTNode) : ASTWrapperPsiElement(node), TLSchemaLcIdentNs { + override fun setName(newName: String): PsiElement { + return TLSchemaPsiImplUtil.setName(this, newName) + } + + override fun getName(): String? { + return TLSchemaPsiImplUtil.getName(this) + } + + override fun getLcIdentNode(): TLSchemaLcIdentNode { + return findNotNullChildByClass(TLSchemaLcIdentNode::class.java) + } + + override fun getNamespaceIdent(): TLSchemaNamespaceIdent? { + return findChildByClass(TLSchemaNamespaceIdent::class.java) + } + + override fun getDeclaration(): TLSchemaDeclaration { + return TLSchemaPsiImplUtil.getDeclaration(this) + } + + override fun getReference(): PsiReference? { + return TLSchemaPsiImplUtil.getReference(this) + } + + override fun getReferences(): Array { + return TLSchemaPsiImplUtil.getReferences(this) + } + + override fun getPresentation(): ItemPresentation? { + return TLSchemaPsiImplUtil.getPresentation(this) + } +} diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaResultTypeMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaResultTypeMixin.kt new file mode 100644 index 0000000..324b261 --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaResultTypeMixin.kt @@ -0,0 +1,12 @@ +package com.vk.tlschema.psi.mixins + +import com.intellij.lang.ASTNode +import com.vk.tlschema.psi.TLSchemaDeclaration +import com.vk.tlschema.psi.TLSchemaResultType +import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil + +internal abstract class TLSchemaResultTypeMixin(node: ASTNode) : TLSchemaElementMixin(node), TLSchemaResultType { + override fun getDeclaration(): TLSchemaDeclaration? { + return TLSchemaPsiImplUtil.getDeclaration(this) + } +} diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt new file mode 100644 index 0000000..e4f3c04 --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt @@ -0,0 +1,46 @@ +package com.vk.tlschema.psi.mixins + +import com.intellij.extapi.psi.ASTWrapperPsiElement +import com.intellij.lang.ASTNode +import com.intellij.navigation.ItemPresentation +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiReference +import com.vk.tlschema.psi.TLSchemaDeclaration +import com.vk.tlschema.psi.TLSchemaNamespaceIdent +import com.vk.tlschema.psi.TLSchemaUcIdentNode +import com.vk.tlschema.psi.TLSchemaUcIdentNs +import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil + +internal abstract class TLSchemaUcIdentNsMixin(node: ASTNode) : ASTWrapperPsiElement(node), TLSchemaUcIdentNs { + override fun setName(newName: String): PsiElement { + return TLSchemaPsiImplUtil.setName(this, newName) + } + + override fun getName(): String? { + return TLSchemaPsiImplUtil.getName(this) + } + + override fun getUcIdentNode(): TLSchemaUcIdentNode { + return findNotNullChildByClass(TLSchemaUcIdentNode::class.java) + } + + override fun getNamespaceIdent(): TLSchemaNamespaceIdent? { + return findChildByClass(TLSchemaNamespaceIdent::class.java) + } + + override fun getDeclaration(): TLSchemaDeclaration { + return TLSchemaPsiImplUtil.getDeclaration(this) + } + + override fun getReference(): PsiReference? { + return TLSchemaPsiImplUtil.getReference(this) + } + + override fun getReferences(): Array { + return TLSchemaPsiImplUtil.getReferences(this) + } + + override fun getPresentation(): ItemPresentation? { + return TLSchemaPsiImplUtil.getPresentation(this) + } +} diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt new file mode 100644 index 0000000..11f5c75 --- /dev/null +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt @@ -0,0 +1,46 @@ +package com.vk.tlschema.psi.mixins + +import com.intellij.extapi.psi.ASTWrapperPsiElement +import com.intellij.lang.ASTNode +import com.intellij.navigation.ItemPresentation +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiReference +import com.vk.tlschema.psi.TLSchemaDeclaration +import com.vk.tlschema.psi.TLSchemaLcIdentNode +import com.vk.tlschema.psi.TLSchemaUcIdentNode +import com.vk.tlschema.psi.TLSchemaVarIdent +import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil + +internal abstract class TLSchemaVarIdentMixin(node: ASTNode) : ASTWrapperPsiElement(node), TLSchemaVarIdent { + override fun setName(newName: String): PsiElement { + return TLSchemaPsiImplUtil.setName(this, newName) + } + + override fun getName(): String? { + return TLSchemaPsiImplUtil.getName(this) + } + + override fun getLcIdentNode(): TLSchemaLcIdentNode? { + return findChildByClass(TLSchemaLcIdentNode::class.java) + } + + override fun getUcIdentNode(): TLSchemaUcIdentNode? { + return findChildByClass(TLSchemaUcIdentNode::class.java) + } + + override fun getDeclaration(): TLSchemaDeclaration { + return TLSchemaPsiImplUtil.getDeclaration(this) + } + + override fun getReference(): PsiReference? { + return TLSchemaPsiImplUtil.getReference(this) + } + + override fun getReferences(): Array { + return TLSchemaPsiImplUtil.getReferences(this) + } + + override fun getPresentation(): ItemPresentation? { + return TLSchemaPsiImplUtil.getPresentation(this) + } +} From 8dfe94cffbb9108bf58bf95d496e80406f2ed18d Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Mon, 19 Feb 2024 01:25:43 +0300 Subject: [PATCH 03/11] use `Gradle` to generate a parser --- build.gradle.kts | 12 ++++++++++++ src/main/grammars/TLSchema.bnf | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 07ea489..24b4a40 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -74,6 +74,18 @@ tasks { purgeOldFiles = true } + generateParser { + sourceFile = file("src/main/grammars/TLSchema.bnf") + targetRoot = "src/main/gen" + pathToParser = "/com/vk/tlschema/parser/TLSchemaParser.java" + pathToPsiRoot = "/com/vk/tlschema/psi" + purgeOldFiles = true + } + + withType { + dependsOn(generateLexer, generateParser) + } + wrapper { gradleVersion = properties("gradleVersion").get() } diff --git a/src/main/grammars/TLSchema.bnf b/src/main/grammars/TLSchema.bnf index b29b3de..1b7967e 100644 --- a/src/main/grammars/TLSchema.bnf +++ b/src/main/grammars/TLSchema.bnf @@ -11,8 +11,6 @@ elementTypeHolderClass="com.vk.tlschema.psi.TLSchemaTypes" elementTypeClass="com.vk.tlschema.psi.TLSchemaElementType" tokenTypeClass="com.vk.tlschema.psi.TLSchemaTokenType" - - psiImplUtilClass="com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil" } From e5ab8649121c2098756ed055ee5ed99fdff7016e Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Mon, 19 Feb 2024 01:32:07 +0300 Subject: [PATCH 04/11] more typing --- .../com/vk/tlschema/psi/impl/TLSchemaPsiImplUtil.java | 8 ++++++-- .../tlschema/highlighting/TLSchemaBreadcrumbsProvider.kt | 2 +- .../com/vk/tlschema/psi/TLSchemaDeclarationElement.kt | 6 +++--- .../vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt | 6 +++--- .../com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt | 2 +- .../com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt | 2 +- .../com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt | 2 +- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/vk/tlschema/psi/impl/TLSchemaPsiImplUtil.java b/src/main/java/com/vk/tlschema/psi/impl/TLSchemaPsiImplUtil.java index 1238fed..ca1f637 100644 --- a/src/main/java/com/vk/tlschema/psi/impl/TLSchemaPsiImplUtil.java +++ b/src/main/java/com/vk/tlschema/psi/impl/TLSchemaPsiImplUtil.java @@ -18,6 +18,7 @@ import java.util.Set; public class TLSchemaPsiImplUtil { + @Nullable public static TLSchemaLcIdentNs getCombinator(TLSchemaDeclaration decl) { TLSchemaFullCombinatorId type; if (decl.getCombinatorDecl() != null) { @@ -37,6 +38,7 @@ public static TLSchemaLcIdentNs getCombinator(TLSchemaDeclaration decl) { } } + @Nullable public static List getNumVars(TLSchemaDeclaration _decl) { if (_decl.getCombinatorDeclBuiltin() != null) { return null; @@ -87,7 +89,7 @@ public static boolean haveConditionalArgs(TLSchemaDeclaration _decl) { return false; } - + @Nullable public static List getTypeVars(TLSchemaDeclaration _decl) { if (_decl.getCombinatorDeclBuiltin() != null) { return null; @@ -123,6 +125,7 @@ public static TLSchemaResultType getResultType(TLSchemaDeclaration decl) { return type; } + @Nullable public static TLSchemaDeclaration getDeclaration(@NotNull PsiElement element) { return PsiTreeUtil.getParentOfType(element, TLSchemaDeclaration.class); } @@ -183,6 +186,7 @@ public static PsiReference[] getReferences(PsiElement element) { return ReferenceProvidersRegistry.getReferencesFromProviders(element); } + @Nullable public static PsiReference getReference(PsiElement element) { PsiReference[] references = getReferences(element); return references.length == 1 ? references[0] : null; @@ -256,4 +260,4 @@ public Icon getIcon(boolean unused) { } }; } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/vk/tlschema/highlighting/TLSchemaBreadcrumbsProvider.kt b/src/main/kotlin/com/vk/tlschema/highlighting/TLSchemaBreadcrumbsProvider.kt index 7452f4b..82b4904 100644 --- a/src/main/kotlin/com/vk/tlschema/highlighting/TLSchemaBreadcrumbsProvider.kt +++ b/src/main/kotlin/com/vk/tlschema/highlighting/TLSchemaBreadcrumbsProvider.kt @@ -21,7 +21,7 @@ class TLSchemaBreadcrumbsProvider : BreadcrumbsProvider { override fun getElementInfo(element: PsiElement): String = when (element) { is TLSchemaFunDeclarations -> "functions" is TLSchemaConstructorDeclarations -> "types" - is TLSchemaDeclaration -> element.getCombinator().getName()!! + is TLSchemaDeclaration -> element.getCombinator()?.getName()!! else -> throw IllegalArgumentException("Not supported") } } diff --git a/src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationElement.kt b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationElement.kt index 811fb56..006a773 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationElement.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/TLSchemaDeclarationElement.kt @@ -1,13 +1,13 @@ package com.vk.tlschema.psi interface TLSchemaDeclarationElement : TLSchemaElement { - fun getCombinator(): TLSchemaLcIdentNs + fun getCombinator(): TLSchemaLcIdentNs? fun getResultType(): TLSchemaResultType - fun getNumVars(): List + fun getNumVars(): List? - fun getTypeVars(): List + fun getTypeVars(): List? fun haveConditionalArgs(): Boolean diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt index e0feb52..250c176 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt @@ -19,7 +19,7 @@ internal abstract class TLSchemaDeclarationMixin(node: ASTNode) : ASTWrapperPsiE return findChildByClass(TLSchemaCombinatorDeclBuiltin::class.java) } - override fun getCombinator(): TLSchemaLcIdentNs { + override fun getCombinator(): TLSchemaLcIdentNs? { return TLSchemaPsiImplUtil.getCombinator(this) } @@ -27,11 +27,11 @@ internal abstract class TLSchemaDeclarationMixin(node: ASTNode) : ASTWrapperPsiE return TLSchemaPsiImplUtil.getResultType(this) } - override fun getNumVars(): MutableList { + override fun getNumVars(): List? { return TLSchemaPsiImplUtil.getNumVars(this) } - override fun getTypeVars(): MutableList { + override fun getTypeVars(): List? { return TLSchemaPsiImplUtil.getTypeVars(this) } diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt index a3ba9b1..ec91211 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt @@ -28,7 +28,7 @@ internal abstract class TLSchemaLcIdentNsMixin(node: ASTNode) : ASTWrapperPsiEle return findChildByClass(TLSchemaNamespaceIdent::class.java) } - override fun getDeclaration(): TLSchemaDeclaration { + override fun getDeclaration(): TLSchemaDeclaration? { return TLSchemaPsiImplUtil.getDeclaration(this) } diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt index e4f3c04..ecc89ea 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt @@ -28,7 +28,7 @@ internal abstract class TLSchemaUcIdentNsMixin(node: ASTNode) : ASTWrapperPsiEle return findChildByClass(TLSchemaNamespaceIdent::class.java) } - override fun getDeclaration(): TLSchemaDeclaration { + override fun getDeclaration(): TLSchemaDeclaration? { return TLSchemaPsiImplUtil.getDeclaration(this) } diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt index 11f5c75..63f2e1e 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt @@ -28,7 +28,7 @@ internal abstract class TLSchemaVarIdentMixin(node: ASTNode) : ASTWrapperPsiElem return findChildByClass(TLSchemaUcIdentNode::class.java) } - override fun getDeclaration(): TLSchemaDeclaration { + override fun getDeclaration(): TLSchemaDeclaration? { return TLSchemaPsiImplUtil.getDeclaration(this) } From cad6240e445319cdd208ccb259e8bbb912b5e426 Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Mon, 19 Feb 2024 01:33:09 +0300 Subject: [PATCH 05/11] fix run configuration --- .run/Run Generate Parser.run.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/.run/Run Generate Parser.run.xml b/.run/Run Generate Parser.run.xml index ad88f45..461c477 100644 --- a/.run/Run Generate Parser.run.xml +++ b/.run/Run Generate Parser.run.xml @@ -11,6 +11,7 @@ diff --git a/build.gradle.kts b/build.gradle.kts index cdde29f..390075e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -74,6 +74,8 @@ tasks { } generateParser { + dependsOn(generateLexer) + sourceFile.set(file("src/main/grammars/TLSchema.bnf")) targetRootOutputDir.set(file("src/main/gen")) pathToParser.set("/com/vk/tlschema/parser/TLSchemaParser.java") @@ -82,7 +84,7 @@ tasks { } withType { - dependsOn(generateLexer, generateParser) + dependsOn(generateParser) } wrapper { From eff8d084133cb0aeef9770069b830080c674d15d Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Mon, 21 Oct 2024 14:53:27 +0300 Subject: [PATCH 09/11] dump version --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index a75376e..28660ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,11 +4,11 @@ pluginGroup = com.vk.tlschema pluginName = TL Schema Support pluginRepositoryUrl = https://github.com/VKCOM/TL-Schema-idea-plugin # SemVer format -> https://semver.org -pluginVersion = 1.4.0 +pluginVersion = 1.4.1 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 223 -pluginUntilBuild = 233.* +pluginUntilBuild = # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType = IC From 990a44041b98c9b1b02909574a88c5b27d4dc2dd Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Wed, 23 Oct 2024 15:02:20 +0300 Subject: [PATCH 10/11] removed the override of autogen functions from `Mixin` --- .../vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt | 10 ---------- .../vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt | 10 ---------- .../vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt | 10 ---------- .../vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt | 10 ---------- 4 files changed, 40 deletions(-) diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt index 250c176..94477fa 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt @@ -2,8 +2,6 @@ package com.vk.tlschema.psi.mixins import com.intellij.extapi.psi.ASTWrapperPsiElement import com.intellij.lang.ASTNode -import com.vk.tlschema.psi.TLSchemaCombinatorDecl -import com.vk.tlschema.psi.TLSchemaCombinatorDeclBuiltin import com.vk.tlschema.psi.TLSchemaDeclaration import com.vk.tlschema.psi.TLSchemaLcIdentNs import com.vk.tlschema.psi.TLSchemaResultType @@ -11,14 +9,6 @@ import com.vk.tlschema.psi.TLSchemaVarIdent import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil internal abstract class TLSchemaDeclarationMixin(node: ASTNode) : ASTWrapperPsiElement(node), TLSchemaDeclaration { - override fun getCombinatorDecl(): TLSchemaCombinatorDecl? { - return findChildByClass(TLSchemaCombinatorDecl::class.java) - } - - override fun getCombinatorDeclBuiltin(): TLSchemaCombinatorDeclBuiltin? { - return findChildByClass(TLSchemaCombinatorDeclBuiltin::class.java) - } - override fun getCombinator(): TLSchemaLcIdentNs? { return TLSchemaPsiImplUtil.getCombinator(this) } diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt index ec91211..2ffb2f0 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt @@ -6,9 +6,7 @@ import com.intellij.navigation.ItemPresentation import com.intellij.psi.PsiElement import com.intellij.psi.PsiReference import com.vk.tlschema.psi.TLSchemaDeclaration -import com.vk.tlschema.psi.TLSchemaLcIdentNode import com.vk.tlschema.psi.TLSchemaLcIdentNs -import com.vk.tlschema.psi.TLSchemaNamespaceIdent import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil internal abstract class TLSchemaLcIdentNsMixin(node: ASTNode) : ASTWrapperPsiElement(node), TLSchemaLcIdentNs { @@ -20,14 +18,6 @@ internal abstract class TLSchemaLcIdentNsMixin(node: ASTNode) : ASTWrapperPsiEle return TLSchemaPsiImplUtil.getName(this) } - override fun getLcIdentNode(): TLSchemaLcIdentNode { - return findNotNullChildByClass(TLSchemaLcIdentNode::class.java) - } - - override fun getNamespaceIdent(): TLSchemaNamespaceIdent? { - return findChildByClass(TLSchemaNamespaceIdent::class.java) - } - override fun getDeclaration(): TLSchemaDeclaration? { return TLSchemaPsiImplUtil.getDeclaration(this) } diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt index ecc89ea..8c5da29 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt @@ -6,8 +6,6 @@ import com.intellij.navigation.ItemPresentation import com.intellij.psi.PsiElement import com.intellij.psi.PsiReference import com.vk.tlschema.psi.TLSchemaDeclaration -import com.vk.tlschema.psi.TLSchemaNamespaceIdent -import com.vk.tlschema.psi.TLSchemaUcIdentNode import com.vk.tlschema.psi.TLSchemaUcIdentNs import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil @@ -20,14 +18,6 @@ internal abstract class TLSchemaUcIdentNsMixin(node: ASTNode) : ASTWrapperPsiEle return TLSchemaPsiImplUtil.getName(this) } - override fun getUcIdentNode(): TLSchemaUcIdentNode { - return findNotNullChildByClass(TLSchemaUcIdentNode::class.java) - } - - override fun getNamespaceIdent(): TLSchemaNamespaceIdent? { - return findChildByClass(TLSchemaNamespaceIdent::class.java) - } - override fun getDeclaration(): TLSchemaDeclaration? { return TLSchemaPsiImplUtil.getDeclaration(this) } diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt index 63f2e1e..be81210 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt @@ -6,8 +6,6 @@ import com.intellij.navigation.ItemPresentation import com.intellij.psi.PsiElement import com.intellij.psi.PsiReference import com.vk.tlschema.psi.TLSchemaDeclaration -import com.vk.tlschema.psi.TLSchemaLcIdentNode -import com.vk.tlschema.psi.TLSchemaUcIdentNode import com.vk.tlschema.psi.TLSchemaVarIdent import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil @@ -20,14 +18,6 @@ internal abstract class TLSchemaVarIdentMixin(node: ASTNode) : ASTWrapperPsiElem return TLSchemaPsiImplUtil.getName(this) } - override fun getLcIdentNode(): TLSchemaLcIdentNode? { - return findChildByClass(TLSchemaLcIdentNode::class.java) - } - - override fun getUcIdentNode(): TLSchemaUcIdentNode? { - return findChildByClass(TLSchemaUcIdentNode::class.java) - } - override fun getDeclaration(): TLSchemaDeclaration? { return TLSchemaPsiImplUtil.getDeclaration(this) } From a7c8c9a39caa3a8d298cda08096e330ac498fdda Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Wed, 23 Oct 2024 15:12:18 +0300 Subject: [PATCH 11/11] removed inheritance from `ASTWrapperPsiElement` for non-basic `ast` nodes --- .../com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt | 3 +-- .../com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt | 3 +-- .../com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt | 3 +-- .../kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt index 94477fa..81b0a0a 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaDeclarationMixin.kt @@ -1,6 +1,5 @@ package com.vk.tlschema.psi.mixins -import com.intellij.extapi.psi.ASTWrapperPsiElement import com.intellij.lang.ASTNode import com.vk.tlschema.psi.TLSchemaDeclaration import com.vk.tlschema.psi.TLSchemaLcIdentNs @@ -8,7 +7,7 @@ import com.vk.tlschema.psi.TLSchemaResultType import com.vk.tlschema.psi.TLSchemaVarIdent import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil -internal abstract class TLSchemaDeclarationMixin(node: ASTNode) : ASTWrapperPsiElement(node), TLSchemaDeclaration { +internal abstract class TLSchemaDeclarationMixin(node: ASTNode) : TLSchemaElementMixin(node), TLSchemaDeclaration { override fun getCombinator(): TLSchemaLcIdentNs? { return TLSchemaPsiImplUtil.getCombinator(this) } diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt index 2ffb2f0..8141ea8 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaLcIdentNsMixin.kt @@ -1,6 +1,5 @@ package com.vk.tlschema.psi.mixins -import com.intellij.extapi.psi.ASTWrapperPsiElement import com.intellij.lang.ASTNode import com.intellij.navigation.ItemPresentation import com.intellij.psi.PsiElement @@ -9,7 +8,7 @@ import com.vk.tlschema.psi.TLSchemaDeclaration import com.vk.tlschema.psi.TLSchemaLcIdentNs import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil -internal abstract class TLSchemaLcIdentNsMixin(node: ASTNode) : ASTWrapperPsiElement(node), TLSchemaLcIdentNs { +internal abstract class TLSchemaLcIdentNsMixin(node: ASTNode) : TLSchemaElementMixin(node), TLSchemaLcIdentNs { override fun setName(newName: String): PsiElement { return TLSchemaPsiImplUtil.setName(this, newName) } diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt index 8c5da29..42f8d9c 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaUcIdentNsMixin.kt @@ -1,6 +1,5 @@ package com.vk.tlschema.psi.mixins -import com.intellij.extapi.psi.ASTWrapperPsiElement import com.intellij.lang.ASTNode import com.intellij.navigation.ItemPresentation import com.intellij.psi.PsiElement @@ -9,7 +8,7 @@ import com.vk.tlschema.psi.TLSchemaDeclaration import com.vk.tlschema.psi.TLSchemaUcIdentNs import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil -internal abstract class TLSchemaUcIdentNsMixin(node: ASTNode) : ASTWrapperPsiElement(node), TLSchemaUcIdentNs { +internal abstract class TLSchemaUcIdentNsMixin(node: ASTNode) : TLSchemaElementMixin(node), TLSchemaUcIdentNs { override fun setName(newName: String): PsiElement { return TLSchemaPsiImplUtil.setName(this, newName) } diff --git a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt index be81210..3e77324 100644 --- a/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt +++ b/src/main/kotlin/com/vk/tlschema/psi/mixins/TLSchemaVarIdentMixin.kt @@ -1,6 +1,5 @@ package com.vk.tlschema.psi.mixins -import com.intellij.extapi.psi.ASTWrapperPsiElement import com.intellij.lang.ASTNode import com.intellij.navigation.ItemPresentation import com.intellij.psi.PsiElement @@ -9,7 +8,7 @@ import com.vk.tlschema.psi.TLSchemaDeclaration import com.vk.tlschema.psi.TLSchemaVarIdent import com.vk.tlschema.psi.impl.TLSchemaPsiImplUtil -internal abstract class TLSchemaVarIdentMixin(node: ASTNode) : ASTWrapperPsiElement(node), TLSchemaVarIdent { +internal abstract class TLSchemaVarIdentMixin(node: ASTNode) : TLSchemaElementMixin(node), TLSchemaVarIdent { override fun setName(newName: String): PsiElement { return TLSchemaPsiImplUtil.setName(this, newName) }