Skip to content

Commit

Permalink
feat: localrule directive support.
Browse files Browse the repository at this point in the history
Closes #525
  • Loading branch information
iromeo committed Oct 22, 2024
1 parent 47aa14c commit 4bf1d4d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 46 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Released on <not released>
- 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))
Expand Down
3 changes: 3 additions & 0 deletions snakemake_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
75 changes: 38 additions & 37 deletions src/test/resources/features/completion/keywords_completion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -257,43 +257,44 @@ Feature: Completion for snakemake keyword-like things
<result>:
"""
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4bf1d4d

Please sign in to comment.