diff options
author | Kyle Meyer <kyle@kyleam.com> | 2022-02-22 21:06:07 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2022-02-22 21:09:22 -0500 |
commit | 3e5f73c259b6134bce6b4fd01830833a3f585cef (patch) | |
tree | 0e8d9b370a1471f0fe071bc0fbb77f359d930373 | |
parent | 7362ecce2b9b29d93dcc2119bbdeb0800d6a2b86 (diff) | |
download | snakemake-mode-3e5f73c259b6134bce6b4fd01830833a3f585cef.tar.gz |
mode: Add support for new module syntax
Snakemake 6.0 introduced a module syntax that looks like this:
module other_workflow:
snakefile:
"other_workflow/Snakefile"
use rule * from other_workflow as other_*
Give the new module block the same indentation and fontification as
other blocks by adding "module" to the list of words that mark a named
rule.
For the "use rule" line, highlight "use rule" as a keyword, leaving
the rest of the line to be highlighted by python.el.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | snakemake-mode.el | 6 |
2 files changed, 6 insertions, 2 deletions
@@ -12,6 +12,8 @@ NEWS -- history of user-visible changes -*- mode: org; -*- by ~--cores~ to follow upstream changes. ~--cores~ is bound to ~-c~, and ~--use-conda~ has been moved from ~-c~ to ~-C~. +- Snakemake's new module syntax (added in v6.0) is now supported. + - Additional Snakemake keywords are now recognized: 'containerized' (new in Snakemake v6.0.0), 'default_target' (new in Snakemake v6.15.0), 'handover' (new in Snakemake v6.2.0), 'name' (new in diff --git a/snakemake-mode.el b/snakemake-mode.el index e87c25a..8694762 100644 --- a/snakemake-mode.el +++ b/snakemake-mode.el @@ -75,8 +75,9 @@ (eval-and-compile (defconst snakemake-rx-constituents - `((named-rule . ,(rx (and (group symbol-start - (or "checkpoint" "rule" "subworkflow")) + `((named-rule . ,(rx (and (group + symbol-start + (or "checkpoint" "module" "rule" "subworkflow")) " " (group (one-or-more (or (syntax word) (syntax symbol))))))) @@ -452,6 +453,7 @@ embedded R, you need to set mmm-global-mode to a non-nil value such as 'maybe.") (group sm-command) (zero-or-more space) ":") 1 font-lock-keyword-face) + (,(rx line-start (group "use rule ")) 1 font-lock-keyword-face) (,(snakemake-rx (group sm-builtin)) 1 font-lock-builtin-face))) (if (bound-and-true-p python-font-lock-keywords-level-1) |