feat(lua): for / function snippets overhaul #537
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rewrite and add more snippets for the
for
statements and functions to cover more use cases.For statements
Before
After
for
is now a generic for loop with zero assumptionfor
loops: numeric range, array table, dictionary tablei=1,10
toi = 1, 10
Functions
Before
After
*fu
/*f=
to support bothfunction name()
andname = function()
style.fu
: Removed space andname
placeholder betweenfunction
and(
function
and(
l*
local variantsmember-function
: Same asf=
but with comma at theend,
.If you assign a function to a key using
f=
, syntax highlights will be broken and the LSP complains until you finally insert the,
after finishing writing the function.Misc
Capitalized the descriptions of the snippets.
Not entirely sure about the styling / punctuation convention for the descriptions and names, though.
The
CONTRIBUTING.md
is missing, and I see no consistency in other language snippets I looked up for reference.Some snippets are named
foo-bar
like here inlua.json
, some areFoo bar
, I don't know.