mirror of
https://github.com/neovim/neovim.git
synced 2026-07-15 13:50:33 +00:00
refactor(pos,range): extract vim.pos._util
Problem: - To share logic, creating a `vim.Range` currently creates two `vim.Pos` values as intermediates, which causes unnecessary table allocations. - `pos.lua` and `range.lua` contain some overlapping logic. Solution: Add `vim.pos._util`, a module for handling positions represented directly by `row` and `col`.
This commit is contained in:
@@ -133,9 +133,9 @@ local function sort_by_key(fn)
|
||||
end
|
||||
end
|
||||
|
||||
local get_lines = vim.pos._get_lines
|
||||
|
||||
local get_line = vim.pos._get_line
|
||||
-- TODO(ofseed): remove these exported functions by replacing their usages with `vim.pos`.
|
||||
local get_lines = require('vim.pos._util').get_lines
|
||||
local get_line = require('vim.pos._util').get_line
|
||||
|
||||
--- Applies a list of text edits to a buffer. Note: this mutates `text_edits` (sorts in-place and
|
||||
--- adds `_index` fields).
|
||||
|
||||
Reference in New Issue
Block a user