From c03cce3882000182b3ce68c01910c60be7408f05 Mon Sep 17 00:00:00 2001 From: Alberto Hanna Date: Fri, 6 Dec 2024 22:16:35 +0200 Subject: [PATCH 1/3] my edits --- snippets/base.json | 4 ++-- snippets/controls.json | 2 +- snippets/templates.json | 20 ++++++++++++++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/snippets/base.json b/snippets/base.json index 09e0af5..844851e 100644 --- a/snippets/base.json +++ b/snippets/base.json @@ -16,8 +16,8 @@ "Flask route": { "prefix": "route", "body": [ - "@app.route('/${1:route_name}')", - "def ${2:method_name}():", + "@${1:app}.route('/${2:route_name}')", + "def ${3:method_name}():", " pass$0" ] }, diff --git a/snippets/controls.json b/snippets/controls.json index 9af97df..06a45c4 100644 --- a/snippets/controls.json +++ b/snippets/controls.json @@ -13,7 +13,7 @@ }, "Flask route": { "prefix": "froute", - "body": "@app.route('${1:path}')\ndef ${2:func_name}(${3:foo}):\n return render_template('${4:expression}')$0" + "body": "@${1:app}.route('${2:path}')\ndef ${3:func_name}(${4:foo}):\n return render_template('${5:expression}')$0" }, "URL generator": { "prefix": "furl", diff --git a/snippets/templates.json b/snippets/templates.json index 7391f58..f1b64b2 100644 --- a/snippets/templates.json +++ b/snippets/templates.json @@ -13,7 +13,7 @@ }, "Flask block": { "prefix": "fblock", - "body": "{% ${1:block} ${2:foo} %}$3{% end${1:block} %}\n$0" + "body": "{% block ${1:foo} %}$2{% endblock ${1:foo} %}$0" }, "Flask extends": { "prefix": "fextends", @@ -57,11 +57,11 @@ }, "Flask include": { "prefix": "finclude", - "body": "{% include \"${1:template}\" %}$0" + "body": "{% include '${1:template}' %}$0" }, "Flask import": { "prefix": "fimport", - "body": "{% import \"${1:template}\" as ${2:alias} %}\n$0" + "body": "{% import '${1:template}' as ${2:alias} %}\n$0" }, "Flask from import": { "prefix": "ffrom", @@ -74,7 +74,11 @@ }, "Flask url": { "prefix": "furl", - "body": "{{ url_for(\"${1:template}\") }}$0" + "body": "{{ url_for('${1:template}') }}$0" + }, + "Flask static url": { + "prefix": "fsurl", + "body": "{{ url_for('static', filename='${1:css/file.css}') }}$0" }, "Flask title": { "prefix": "ftitle", @@ -87,5 +91,13 @@ "Flask content block": { "prefix": "fcontent", "body": "{% block content %}\n\t${1:Some content}\n{% endblock %}" + }, + "Flask with": { + "prefix": "fwith", + "body": "{% with ${1:foo}=${2:'42'} %}\n\t${3:foo}\n{% endwith %}$0" + }, + "Flask indent": { + "prefix": "findent", + "body": "{% filter indent(${1:4}) -%} ${2:} {%- endfilter %}$0" } } From 168dbf52f8f2749a17b3f190bb9550dab715dcc7 Mon Sep 17 00:00:00 2001 From: Alberto Hanna Date: Fri, 6 Dec 2024 22:19:22 +0200 Subject: [PATCH 2/3] edit .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 815b42a..6640e6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vscode/ vsc-* .DS_Store/ -flask-snippets-* \ No newline at end of file +flask-snippets-* +.vsixmanifest From 9e2da2cb58538bf13f352bd502f17065d8d8bcc9 Mon Sep 17 00:00:00 2001 From: Alberto Hanna Date: Fri, 6 Dec 2024 22:32:41 +0200 Subject: [PATCH 3/3] edit README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bfd12f1..117ad95 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,8 @@ Thanks! | ftitle | Flask title | | fvar | Flask var | | fcontent | Flask content | +| fsurl | Flask static url | +| fwith | Flask with | ## Release Notes