-
-
Notifications
You must be signed in to change notification settings - Fork 265
util: Add types & docs for str utils, cleanup old functions #1419
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
dff7c22 to
c51c1d8
Compare
lua/luasnip/util/str.lua
Outdated
| --- Extract a rectangular block of lines in a multiline string area. | ||
| ---@param lines string[] | ||
| ---@param from LuaSnip.Pos00 From this position, MUST be within `lines`. | ||
| ---@param to LuaSnip.Pos00 To this position (excluded), MUST be within `lines` |
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 this use LuaSnip.RawPos00 instead ?
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.
Sounds reasonable, a buffer is also just a string[], so re-using that indexing scheme is appropriate 👍
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.
done in bb1c84d
lua/luasnip/util/str.lua
Outdated
| function M.multiline_to_byte_offset(str, pos) | ||
| if pos[1] < 0 or pos[1] + 1 > #str or pos[2] < 0 then | ||
| ---@param lines string[] a multiline string | ||
| ---@param pos LuaSnip.ApiPosition an api-position relative to the start of str. |
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.
This LuaSnip.ApiPosition type is not defined 🤔 What do you want here?
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 RawPos00, I think I'm referring to api-indexing
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.
lua/luasnip/util/str.lua
Outdated
| end | ||
| end | ||
|
|
||
| -- FIXME(@L3MON4D3): not used anywhere? |
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 yeah, leftover from a long time ago (13c5dce 👀)
We no longer use vimscript for registering these file-reload-autocommands, feel free to remove it :)
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.
done in bb1c84d
lua/luasnip/util/str.lua
Outdated
| end | ||
|
|
||
| -- modifies strmod | ||
| -- FIXME(@L3MON4D3): not used anywhere? |
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.
Yup, left over, get rid of it :D
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.
done in bb1c84d
|
This is looking really good as well, great work ❤️ |
Extracted from #1396
Depends on #1420