Skip to content

Commit 8dcca66

Browse files
authored
Merge pull request #22 from docker/cm/pylint-5-6
Add tree sitter function and prompt
2 parents 2037beb + e153006 commit 8dcca66

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

functions/tree_sitter/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# PYTHON ONLY
2+
FROM rust
3+
4+
RUN cargo install tree-sitter-cli
5+
6+
# Setup parser
7+
COPY config.json /root/.config/tree-sitter/config.json
8+
9+
RUN <<EOF
10+
mkdir -p /root/parsers
11+
cd /root/parsers
12+
git clone https://github.com/tree-sitter/tree-sitter-python
13+
EOF
14+
15+
ENTRYPOINT [ "/bin/bash", "-c"]

functions/tree_sitter/config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"parser-directories": [
3+
"/root/parsers"
4+
]
5+
}
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
---
22
tools:
3-
- name: run-javascript-sandbox
4-
description: execute javascript code
3+
- name: run-tree-sitter
4+
description: Runs tree sitter in the current directory.
55
parameters:
66
type: object
77
properties:
8-
javascript:
8+
tree_sitter_args:
99
type: string
10-
description: the javascript code to run
10+
description: The args to pass to tree-sitter-cli
1111
container:
12-
image: vonwig/javascript-runner
12+
image: vonwig/tree_sitter
1313
command:
14-
- "{{javascript|safe}}"
14+
- "tree-sitter {{tree_sitter_args|safe}}"
1515
---
1616

1717
# prompt user
18-
Use tree-sitter
18+
19+
Use tree-sitter with args `parse '**/*.py' > /thread/ast.txt`
1920

0 commit comments

Comments
 (0)