diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-11-16 17:03:00 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-11-21 20:18:57 +0100 |
| commit | e4a85d6350577b4903171e8c68db07820bb41408 (patch) | |
| tree | ccf0b5c0f4d7a307d38d218bc9cfc456b2e4ee4c /init.lua | |
| parent | cc2f4949d4949424d939d43e80497d8f5f94b4bc (diff) | |
| download | vis-lspc-e4a85d6350577b4903171e8c68db07820bb41408.tar.gz vis-lspc-e4a85d6350577b4903171e8c68db07820bb41408.zip | |
add functions to compare LSP ranges and positions
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -307,6 +307,16 @@ local function lsp_range_to_vis_range(win, lsp_range) return {start = start_pos, finish = finish_pos} end +-- return true if p1 is before p2 +local function lsp_pos_before(p1, p2) + return p1.line < p2.line or (p1.line == p2.line and p1.character < p2.character) +end + +-- return true if r1 starts before r2 +local function lsp_range_starts_before(r1, r2) + return lsp_pos_before(r1.start, r2.start) +end + -- concatenate all numeric values in choices and pass it on stdin to lspc.menu_cmd local function lspc_select(choices) local menu_input = '' |
