diff options
author | Viktor Kojouharov <developer@sugr.org> | 2021-05-07 16:07:38 +0200 |
---|---|---|
committer | Viktor <viktor.kojouharov@globus.ch> | 2021-06-06 09:59:46 +0200 |
commit | 36d05845f7def1b8416f92dd4fc350276ed64636 (patch) | |
tree | eb4ddab199b04479848187755b776c34a4e0b2cd /runtime/lua/vim/lsp/util.lua | |
parent | b3e3ab0567a1a3c2f97de943ef9d7b24c0008979 (diff) | |
download | rneovim-36d05845f7def1b8416f92dd4fc350276ed64636.tar.gz rneovim-36d05845f7def1b8416f92dd4fc350276ed64636.tar.bz2 rneovim-36d05845f7def1b8416f92dd4fc350276ed64636.zip |
feat(lsp): extend diagnostic.set_loclist
add option to show workspace diagnostic instead of the current buffer's
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 863cfa086d..e2cae2bed9 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1845,8 +1845,9 @@ end --@param row 0-indexed line --@param col 0-indexed byte offset in line --@returns (number, number) UTF-32 and UTF-16 index of the character in line {row} column {col} in buffer {buf} -function M.character_offset(buf, row, col) - local line = api.nvim_buf_get_lines(buf, row, row+1, true)[1] +function M.character_offset(bufnr, row, col) + local uri = vim.uri_from_bufnr(bufnr) + local line = M.get_line(uri, row) -- If the col is past the EOL, use the line length. if col > #line then return str_utfindex(line) |