diff --git a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SnakemakeAPI.kt b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SnakemakeAPI.kt index a5280eb8..b9d006a3 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SnakemakeAPI.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/codeInsight/SnakemakeAPI.kt @@ -455,18 +455,25 @@ class SnakemakeAPIProjectService(val project: Project): Disposable { } contextTypeAndSubsection2LambdaArgs.put(ctxAndName, value) } + } - // functions - val funcIntroductionsByFqn = apiProvider.getFunctionIntroductionsByFqn(smkLangVers) - funcIntroductionsByFqn.forEach { (fqn, versAndParams) -> - val (_, params) = versAndParams + // functions + val funcIntroductionsByFqn = apiProvider.getFunctionIntroductionsByFqn(smkLangVers) + funcIntroductionsByFqn.forEach { (fqn, versAndParams) -> + val (_, params) = versAndParams - if (params.isPlaceholderInjectionAllowed) { - funFqnValidForInjection.add(fqn) + if (params.limitToSections.isNotEmpty()) { + val value = params.limitToSections.toTypedArray() + require(value.isNotEmpty()) { + "YAML format error: 'limitToSections' should not be empty for function '${fqn}'." } + funFqnToSectionRestrictionList.put(fqn, value) + } + + if (params.isPlaceholderInjectionAllowed) { + funFqnValidForInjection.add(fqn) } } - funFqnToSectionRestrictionList SnakemakeAPIProjectState( contextType2SingleArgSectionKeywords = contextType2SingleArgSectionKeywords.toImmutableMap(), diff --git a/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkAPIAnnParams.kt b/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkAPIAnnParams.kt index b5a2362a..2a2032a5 100644 --- a/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkAPIAnnParams.kt +++ b/src/main/kotlin/com/jetbrains/snakecharm/framework/snakemakeAPIAnnotations/SmkAPIAnnParams.kt @@ -15,6 +15,7 @@ data class SmkKeywordDeprecationParams( } data class SmkKeywordIntroductionParams( + //val name: String, val lambdaArgs: List, val keywordArgsAllowed: Boolean, val multipleArgsAllowed: Boolean, @@ -27,6 +28,7 @@ data class SmkKeywordIntroductionParams( ) { companion object { fun createFrom(rec: SmkAPIAnnParsingIntroductionRecord) = SmkKeywordIntroductionParams( + //name = rec.name, lambdaArgs = rec.lambda_args, limitToSections = rec.limit_to_sections, keywordArgsAllowed = rec.keyword_args_allowed, diff --git a/src/test/resources/features/completion/keywords_completion.feature b/src/test/resources/features/completion/keywords_completion.feature index c764b206..ab24960e 100644 --- a/src/test/resources/features/completion/keywords_completion.feature +++ b/src/test/resources/features/completion/keywords_completion.feature @@ -378,7 +378,7 @@ Feature: Completion for snakemake keyword-like things | rule_like | rule_like_removed | lang_version | expected_item | expected_item_type | missing_item | deprecated_key | removed_key | introduced_key | | rule | rule | 1.0.0 | input | deprecated 1.0.0, removed 2.0.0 | output | input | output | log | | rule | checkpoint | 1.0.0 | output | | xxx | input | output | log | - | rule | module | 1.0.0 | output | | xxx | input | output | log | + | rule | module | 1.0.0 | input | deprecated 1.0.0, removed 2.0.0 | output | input | output | log | | checkpoint | checkpoint | 1.0.0 | input | deprecated 1.0.0, removed 2.0.0 | output | input | output | log | | rule | rule | 2.0.0 | log | >=2.0.0 | input | input | output | log | | rule | rule | 1.0.0 | threads | >=0.0.1, deprecated 2.0.0 | xxx | input | output | log |