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.
Sometimes we are not sure whether functions return a tuple or a table, assuming we need to get a position containing
row
andcol
, wrote:Then we found
position
here is aninteger
, not atable
(by inlay hint or diagnostic info), which meansget 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.That's why I think this snippet is useful.