summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/pos.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-16feat(docs): render class dot members as module functionsYi Ming1
AI-assisted: Codex
2026-04-15revert: "docs: vim.range, vim.pos #38869"Yi Ming1
This reverts commit c530fd8e752607f57b83854b74b029eabe8d57c6.
2026-04-12docs: vim.posJustin M. Keyes1
2026-04-08docs: vim.range, vim.pos #38869Luis Calle1
Problem: `vim.Range` and `vim.Pos` have signature mismatches on the docs of some functions. Solution: Split the "module" functions from the "class" functions (just like it's done in other modules like `vim.version`) and regenerate the docs.
2026-04-06feat(vim.pos)!: require `buf` param on vim.pos, vim.range #38665Luis Calle1
Problem: `buf` is optional even though its needed to perform conversions and the ordering of `(buf, row, col)` is not consistent. Solution: make `buf` mandatory on `vim.range` and `vim.pos` and enforce the `buf, row, col` ordering
2026-04-01perf(vim.pos): use `nvim_buf_line_count` instead of fetching all lines #38686Luis Calle1
2026-03-29docs: misc #38532Justin M. Keyes1
Close #38431 Close #38521 Close #38530 Co-authored-by: tayheau <thopsore@pasteur.fr> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Olivia Kinnear <git@superatomic.dev>
2026-03-29feat: extend vim.Pos, vim.Range #36397Luis Calle1
Problem: Using nested `vim.Pos` objects to represent each `vim.Range` object requires 3 tables for each `vim.Range`, which may be undesirable in performance critical code. Using key-value tables performs worse than using array-like tables (lists). Solution: Use array-like indices for the internal fields of both `vim.Pos` and `vim.Range` objects. Use a metatable to allow users to access them like if they were key-value tables. --- Problem: The `vim.Pos` conversion interface for `extmark` indexing does not take into account the difference in how a position on top of a newline is represented in `vim.Pos` and `extmark`. - `vim.Pos`: for a newline at the end of row `n`, `row` takes the value `n + 1` and `col` takes the value `0`. - `extmark`: for a newline at the end of for `n`, `row` takes the value `n` and `col` takes the value `#row_text`. Solution: Handle this in the `extmark` interface. --- Problem: Not all `to_xxx` interfaces have wrapping objects like `to_lsp`. Solution: Return unwrapped values in `to_xxx` interfaces where it makes sense. Accept unwrapped values in "from" interfaces where it makes sense. --- Problem: `start` and `end` positions have different semantics, so they can't be compared. `vim.Range` relies on comparing the `end` and `start` of two ranges to decide which one is greater, which doesn't work as expected because this of the different semantics. For example, for the ranges: local a = { start = { row = 0, col = 22, }, end_ = { row = 0, col = 24, }, } local b = { start = { row = 0, col = 17, }, end_ = { row = 0, col = 22, }, } in this code: local foo, bar = "foo", "bar" -- |---||-| -- b a The range `b` is smaller than the range `a`, but the current implementation compares `b._end` (`col = 22`) and `a.start` (`col = 22`) and concludes that, since `b.col` is not smaller than `a.col`, `b` should be greater than `a`. Solution: - Use a `to_inclusive_pos` to normalize end positions inside of `vim.Range` whenever a comparison between a start and an end position is necessary.
2025-08-24Merge #33972 feat(lsp): textDocument/inlineCompletionJustin M. Keyes1
2025-08-24docs: misc #35459Justin M. Keyes1
2025-08-24fix(lua): disable `strict_indexing` when converting LSP positionsYi Ming1
2025-08-24feat(lua): conversion between extmark positionsYi Ming1
2025-08-24feat(lua): conversion between cursor positionsYi Ming1
2025-08-24docs(lua): mark `vim.Pos.Optional` as optionalYi Ming1
2025-08-17feat(lua): conversion between vim and lsp position/rangeYi Ming1
2025-08-17feat(lua): `vim.pos`/`vim.range`Yi Ming1