-
-
Notifications
You must be signed in to change notification settings - Fork 265
Rework pos types, add types for mark utils #1420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed in f079e72
|
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)