From 4bf1d4df2df706bf36e8b96f0f28467f977cea20 Mon Sep 17 00:00:00 2001 From: Roman Chernyatchik Date: Tue, 22 Oct 2024 10:58:20 +0200 Subject: [PATCH] feat: localrule directive support. Closes #525 --- CHANGELOG.md | 1 + snakemake_api.yaml | 3 + .../completion/keywords_completion.feature | 75 ++++++++++--------- .../multiple_args_inspection.feature | 9 ++- ...unexpected_keyword_args_inspection.feature | 11 +-- 5 files changed, 53 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 957bf379..cb8ee78a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Released on - Inspection: Warn if snakemake section type or API function isn't supported in the current snakemake project based on a snakemake version (see [#500](https://github.com/JetBrains-Research/snakecharm/issues/500) - Code completion: For section keywords show 'since' version and deprecation notice in the completion list. Do not suggest already removed keywords (see [#535](https://github.com/JetBrains-Research/snakecharm/issues/535) - Resource scopes support (see [#510](https://github.com/JetBrains-Research/snakecharm/issues/510) +- Snakecharm does not recognize localrule directive (see [#524](https://github.com/JetBrains-Research/snakecharm/issues/524) ### Fixed - Improve parser error message when rule/module is declared with name but lacks ':' (see [#515](https://github.com/JetBrains-Research/snakecharm/issues/515)) diff --git a/snakemake_api.yaml b/snakemake_api.yaml index f55d2cd6..fea17486 100644 --- a/snakemake_api.yaml +++ b/snakemake_api.yaml @@ -80,6 +80,9 @@ changelog: introduced: - name: "localrule" type: "rule-like" + docs_url: https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#local-rules + multiple_args_allowed: False + keyword_args_allowed: False # ---------------------- - version: "7.7.0" diff --git a/src/test/resources/features/completion/keywords_completion.feature b/src/test/resources/features/completion/keywords_completion.feature index 8f052f32..8ead6959 100644 --- a/src/test/resources/features/completion/keywords_completion.feature +++ b/src/test/resources/features/completion/keywords_completion.feature @@ -257,43 +257,44 @@ Feature: Completion for snakemake keyword-like things : """ Examples: - | rule_like | str | result | - | rule | inp | input | - | checkpoint | inp | input | - | rule | out | output | - | checkpoint | out | output | - | rule | par | params | - | checkpoint | par | params | - | rule | be | benchmark | - | checkpoint | be | benchmark | - | rule | vers | version | - | checkpoint | vers | version | - | rule | cac | cache | - | checkpoint | cac | cache | - | rule | mes | message | - | checkpoint | mes | message | - | rule | pr | priority | - | checkpoint | pr | priority | - | rule | gr | group | - | checkpoint | gr | group | - | rule | envm | envmodules | - | checkpoint | envm | envmodules | - | rule | cw | cwl | - | checkpoint | cw | cwl | - | rule | sc | script | - | checkpoint | sc | script | - | rule | run | run | - | checkpoint | run | run | - | rule | wr | wrapper | - | checkpoint | wr | wrapper | - | rule | na | name | - | checkpoint | na | name | - | rule | han | handover | - | checkpoint | han | handover | - | rule | defa | default_target | - | checkpoint | defa | default_target | - | rule | retr | retries | - | rule | temp | template_engine | + | rule_like | str | result | + | rule | inp | input | + | checkpoint | inp | input | + | rule | out | output | + | checkpoint | out | output | + | rule | par | params | + | checkpoint | par | params | + | rule | be | benchmark | + | checkpoint | be | benchmark | + | rule | vers | version | + | checkpoint | vers | version | + | rule | cac | cache | + | checkpoint | cac | cache | + | rule | mes | message | + | checkpoint | mes | message | + | rule | pr | priority | + | checkpoint | pr | priority | + | rule | gr | group | + | checkpoint | gr | group | + | rule | envm | envmodules | + | checkpoint | envm | envmodules | + | rule | cw | cwl | + | checkpoint | cw | cwl | + | rule | sc | script | + | checkpoint | sc | script | + | rule | run | run | + | checkpoint | run | run | + | rule | wr | wrapper | + | checkpoint | wr | wrapper | + | rule | na | name | + | checkpoint | na | name | + | rule | han | handover | + | checkpoint | han | handover | + | rule | defa | default_target | + | checkpoint | defa | default_target | + | rule | retr | retries | + | rule | retr | retries | + | rule | loc | localrule | Scenario Outline: Complete at rule/checkpoint/module level (multiple variants) Given a snakemake project diff --git a/src/test/resources/features/highlighting/inspections/multiple_args_inspection.feature b/src/test/resources/features/highlighting/inspections/multiple_args_inspection.feature index e7581099..b2530b8f 100644 --- a/src/test/resources/features/highlighting/inspections/multiple_args_inspection.feature +++ b/src/test/resources/features/highlighting/inspections/multiple_args_inspection.feature @@ -40,10 +40,11 @@ Feature: Inspection for multiple arguments in various sections """ When I check highlighting errors Examples: - | section | - | shell | - | threads | - | shadow | + | section | + | shell | + | threads | + | shadow | + | localrule | Scenario Outline: Multiple arguments in workflow section in latest language level Given a snakemake project diff --git a/src/test/resources/features/highlighting/inspections/unexpected_keyword_args_inspection.feature b/src/test/resources/features/highlighting/inspections/unexpected_keyword_args_inspection.feature index 83ff1170..32de3bac 100644 --- a/src/test/resources/features/highlighting/inspections/unexpected_keyword_args_inspection.feature +++ b/src/test/resources/features/highlighting/inspections/unexpected_keyword_args_inspection.feature @@ -31,11 +31,12 @@ Feature: Inspection for unexpected keyword arguments in section """ When I check highlighting errors Examples: - | rule_like | section | - | rule | benchmark | - | rule | conda | - | checkpoint | message | - | module | config | + | rule_like | section | + | rule | benchmark | + | rule | conda | + | checkpoint | message | + | module | config | + | module | localrule | Scenario Outline: No warn on expected keyword arguments in rule\checkpoint in latest language level