diff --git a/CHANGELOG.md b/CHANGELOG.md index 7484fc8f..b92e6d8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,17 +4,10 @@ # SnakeCharm Plugin Changelog ## [2024.2.3] -Released on - - -### Features -- TODO +Released on 5 November 2024 ### Fixed -- TODO - -### Changed -- TODO +- Wildcard is not properly defined false positive warning when typing first input, then output section (see [#557](https://github.com/JetBrains-Research/snakecharm/issues/557) ## [2024.2.2] diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt index 010407cf..91b66065 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkRuleOrCheckpointArgsSectionImpl.kt @@ -85,7 +85,9 @@ open class SmkRuleOrCheckpointArgsSectionImpl(node: ASTNode) : SmkArgsSectionImp ) } - override val isWildcardsDefiningSection = sectionKeyword in WILDCARDS_DEFINING_SECTIONS_KEYWORDS + override val isWildcardsDefiningSection by lazy { + sectionKeyword in WILDCARDS_DEFINING_SECTIONS_KEYWORDS + } override fun multilineSectionDefinition(): Boolean = multilineSectionDefinition(this) diff --git a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt index 1abb9e9e..6a80bf66 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/lang/psi/impl/SmkUseArgsSectionImpl.kt @@ -33,5 +33,7 @@ class SmkUseArgsSectionImpl(node: ASTNode) : SmkArgsSectionImpl(node), SmkRuleOr ) } - override val isWildcardsDefiningSection = sectionKeyword in WILDCARDS_DEFINING_SECTIONS_KEYWORDS + override val isWildcardsDefiningSection by lazy { + sectionKeyword in WILDCARDS_DEFINING_SECTIONS_KEYWORDS + } } \ No newline at end of file diff --git a/src/test/resources/features/highlighting/inspections/wildcard_not_defined_inpection.feature b/src/test/resources/features/highlighting/inspections/wildcard_not_defined_inpection.feature index 58b903c5..e45e40ab 100644 --- a/src/test/resources/features/highlighting/inspections/wildcard_not_defined_inpection.feature +++ b/src/test/resources/features/highlighting/inspections/wildcard_not_defined_inpection.feature @@ -174,6 +174,35 @@ Feature: Inspection: SmkWildcardNotDefinedInspection | checkpoint | | checkpoint | + Scenario: Correctly hide error on typing output section + Given a snakemake project + Given I open a file "foo.smk" with text + """ + rule foo: + input: "foo/{sample}" + # formatter hack + """ + And I put the caret after "foo/{sample}" + And SmkWildcardNotDefinedInspection inspection is enabled + Then I expect inspection error on with message + """ + Wildcard 'sample' isn't properly defined. + """ + When I check highlighting errors + When I type multiline text '\noutput: ' at the caret position + When I type multiline text '"boo/{sampl}"' at the caret position + And I put the caret after "boo/{sampl + When I type multiline text 'e' at the caret position + Then I expect text in current file: + """ + rule foo: + input: "foo/{sample}" + output: "boo/{sample}" + # formatter hack + """ + Then I expect no inspection errors + When I check highlighting errors + Scenario Outline: Undefined wildcard if it is was defined in sections, which is overridden Given a snakemake project Given I open a file "foo.smk" with text