mirror of https://github.com/helix-editor/helix
Adding snakemake to language (#11858)
* feat: snakemake language * feat: snakemake syntax highlighting * doc: xtask docgen - snakemake * Addressed feedback: removed redundant grammar * fixed indentation * removed has-ancestor predicate --------- Co-authored-by: “SebastianDall” <“semoda@bio.auu.dk”>pull/9643/head
parent
855a43a266
commit
a1453350df
@ -0,0 +1,20 @@
|
||||
Copyright (c) 2016 Max Brunsfeld
|
||||
Copyright (c) 2023 Oliver Thomas
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -0,0 +1,8 @@
|
||||
; inherits: python
|
||||
|
||||
[
|
||||
(rule_definition)
|
||||
(rule_inheritance)
|
||||
(module_definition)
|
||||
(checkpoint_definition)
|
||||
] @fold
|
@ -0,0 +1,76 @@
|
||||
; inherits: python
|
||||
|
||||
; Compound directives
|
||||
[
|
||||
"rule"
|
||||
"checkpoint"
|
||||
"module"
|
||||
] @keyword
|
||||
|
||||
; Top level directives (eg. configfile, include)
|
||||
(module
|
||||
(directive
|
||||
name: _ @keyword))
|
||||
|
||||
; Subordinate directives (eg. input, output)
|
||||
((_)
|
||||
body: (_
|
||||
(directive
|
||||
name: _ @label)))
|
||||
|
||||
; rule/module/checkpoint names
|
||||
(rule_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(module_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(checkpoint_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
; Rule imports
|
||||
(rule_import
|
||||
"use" @keyword.import
|
||||
"rule" @keyword.import
|
||||
"from" @keyword.import
|
||||
"exclude"? @keyword.import
|
||||
"as"? @keyword.import
|
||||
"with"? @keyword.import)
|
||||
|
||||
; Rule inheritance
|
||||
(rule_inheritance
|
||||
"use" @keyword
|
||||
"rule" @keyword
|
||||
"with" @keyword)
|
||||
|
||||
; Wildcard names
|
||||
(wildcard (identifier) @variable)
|
||||
(wildcard (flag) @variable.parameter.builtin)
|
||||
|
||||
; builtin variables
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin "checkpoints" "config" "gather" "rules" "scatter" "workflow"))
|
||||
|
||||
; References to directive labels in wildcard interpolations
|
||||
; the #any-of? queries are moved above the #has-ancestor? queries to
|
||||
; short-circuit the potentially expensive tree traversal, if possible
|
||||
; see:
|
||||
; https://github.com/nvim-treesitter/nvim-treesitter/pull/4302#issuecomment-1685789790
|
||||
; directive labels in wildcard context
|
||||
((wildcard
|
||||
(identifier) @label)
|
||||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards"))
|
||||
|
||||
((wildcard
|
||||
(attribute
|
||||
object: (identifier) @label))
|
||||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards"))
|
||||
|
||||
((wildcard
|
||||
(subscript
|
||||
value: (identifier) @label))
|
||||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards"))
|
||||
|
||||
; directive labels in block context (eg. within 'run:')
|
||||
((identifier) @label
|
||||
(#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards"))
|
@ -0,0 +1,27 @@
|
||||
; inherits: python
|
||||
|
||||
|
||||
[
|
||||
(rule_definition)
|
||||
(checkpoint_definition)
|
||||
(rule_inheritance)
|
||||
(module_definition)
|
||||
] @indent
|
||||
|
||||
[
|
||||
(rule_definition)
|
||||
(checkpoint_definition)
|
||||
(rule_inheritance)
|
||||
(module_definition)
|
||||
] @extend
|
||||
|
||||
|
||||
(directive) @indent
|
||||
(directive) @extend
|
||||
|
||||
(rule_import
|
||||
"with"
|
||||
":") @indent
|
||||
(rule_import
|
||||
"with"
|
||||
":") @extend
|
@ -0,0 +1,5 @@
|
||||
; inherits: python
|
||||
|
||||
(wildcard
|
||||
(constraint) @injection.content
|
||||
(#set! injection.language "regex"))
|
@ -0,0 +1 @@
|
||||
; inherits: python
|
Loading…
Reference in New Issue