Rework pos types, add types for mark utils#1420
Rework pos types, add types for mark utils#1420bew wants to merge 11 commits intoL3MON4D3:masterfrom
Conversation
| ---@param p2 LuaSnip.RawPos00|LuaSnip.Pos00 | ||
| ---@return boolean | ||
| -- | ||
| -- FIXME(@bew): I don't know how to enforce the use of the same type of pos.. |
There was a problem hiding this comment.
I think it should be doable via @overload, but I'm not getting the correct results with this simple example
---@param a number
---@param b number
---@return boolean
---@overload fun(table,table) : boolean
local function test(a, b) return a == b end
test(1,{})
lua/luasnip/util/util.lua
Outdated
| -- FIXME(@L3MON4D3): Is this documentation correct? It looks the same as | ||
| -- `pos_offset` above 🤔 |
There was a problem hiding this comment.
Oh, no it is incorrect, good catch 👍
pos_from_offset computes the end-position of text with offset[1] lines and offset[2] columns in the last line inserted at base_pos. So, something of an inverse to pos_offset.
There was a problem hiding this comment.
could you make a full suggestion to replace the doc of that function?
(I don't have the brain power to think much to rewrite that doc right now 👀)
There was a problem hiding this comment.
Sure :)
--- Given an offset computed via `pos_offset`, compute its position when
--- applied to `base_pos`.We use pos_offset to store the cursor-position relative to the node it is currently in, and then pos_from_offset to recover the cursor at a new node-position base_pos (store_cursor_node_relative, restore_cursor_pos_relative)
|
could we get this merged ? it's an important one to get the ball rolling ;) |
Extracted from #1396 (and reworked a little)
Mark:updatemethod (ref)