Skip to content

Conversation

ofseed
Copy link
Contributor

@ofseed ofseed commented Jun 19, 2024

Sometimes we are not sure whether functions return a tuple or a table, assuming we need to get a position containing row and col, wrote:

local position = get_position()

Then we found position here is an integer, not a table (by inlay hint or diagnostic info), which means get position returns a tuple. In this situation, a postfix snippet will be useful because our cursor is at the end of the line. By simply typing @unpack we can turn it into a tuple.

local position = unpack(get_position())

That's why I think this snippet is useful.

@ofseed ofseed changed the title Add postfix completion for unpack Add postfix snippet for unpack Jun 19, 2024
@sumneko sumneko merged commit ffee37b into LuaLS:master Jun 25, 2024
@sumneko
Copy link
Collaborator

sumneko commented Jun 25, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants