feat(treesitter): support for snakemake (#316)

* add snakemake, based off of python

* add snakemake test file

* add example (but currently incorrect) test file

* fix tests
This commit is contained in:
Ryan Dale 2023-10-17 10:58:08 -04:00 committed by GitHub
parent ffdda791c0
commit c306ffcf34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,19 @@
(function_definition
name: (identifier) @name
(#set! "kind" "Function")
) @type
(class_definition
name: (identifier) @name
(#set! "kind" "Class")
) @type
(assignment
left: (_) @name
(#set! "kind" "Variable")
) @type
(rule_definition
name: (identifier) @name
(#set! "kind" "Class")
) @type

View file

@ -9,6 +9,7 @@ vim.filetype.add({
norg = "norg", -- Neovim doesn't have built-in norg filetype detection
usd = "usd", -- Neovim doesn't have built-in USD filetype detection
usda = "usd", -- Neovim doesn't have built-in USD filetype detection
smk = "snakemake", -- Neovim doesn't have built-in Snakemake filetype detection
},
})

View file

@ -0,0 +1,47 @@
[
{
"col": 0,
"end_col": 27,
"end_lnum": 7,
"kind": "Class",
"level": 0,
"lnum": 1,
"name": "all",
"selection_range": {
"col": 5,
"end_col": 8,
"end_lnum": 1,
"lnum": 1
}
},
{
"col": 0,
"end_col": 8,
"end_lnum": 10,
"kind": "Function",
"level": 0,
"lnum": 9,
"name": "f",
"selection_range": {
"col": 4,
"end_col": 5,
"end_lnum": 9,
"lnum": 9
}
},
{
"col": 0,
"end_col": 10,
"end_lnum": 12,
"kind": "Variable",
"level": 0,
"lnum": 12,
"name": "var",
"selection_range": {
"col": 0,
"end_col": 3,
"end_lnum": 12,
"lnum": 12
}
}
]

View file

@ -0,0 +1,12 @@
rule all:
input:
"b.txt"
output:
"c.txt"
shell:
"ls -la > {output}"
def f():
pass
var = 'hi'