Skip to content

Commit

Permalink
basic lua snippet support (#1566)
Browse files Browse the repository at this point in the history
Not nearly at the level of Python snippet support, but already quite
useful.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Nicholas Riley <com-github@sabi.net>
  • Loading branch information
3 people authored Oct 5, 2024
1 parent d426076 commit 7ef1602
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/snippets/snippets/elseIfStatement.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ language: python
elif $1:
$0
---

language: lua
-
elseif $1 then
$0
---
6 changes: 6 additions & 0 deletions core/snippets/snippets/elseStatement.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ language: python
else:
$0
---

language: lua
-
else
$0
---
7 changes: 7 additions & 0 deletions core/snippets/snippets/ifStatement.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ language: python
if $1:
$0
---

language: lua
-
if $1 then
$0
end
---
21 changes: 21 additions & 0 deletions core/snippets/snippets/lua.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
language: lua
---

name: forInIPairs
phrase: for eye pairs
insertionScope: statement
$1.insertionFormatter: SNAKE_CASE
-
for _, $1 in ipairs($2) do
$0
end
---

name: forInPairs
phrase: for pairs
insertionScope: statement
-
for ${1:k}, ${2:v} in pairs($3) do
$0
end
---
5 changes: 5 additions & 0 deletions core/snippets/snippets/ternary.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ language: python
-
$1 if $2 else $0
---

language: lua
-
$1 and $2 or $0
---

0 comments on commit 7ef1602

Please sign in to comment.