diff options
author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-06-06 03:16:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-06 03:16:43 -0700 |
commit | 37d5236f88810eb399732951ca32206dcc1915a3 (patch) | |
tree | eb4ddab199b04479848187755b776c34a4e0b2cd /runtime/lua/vim/lsp/util.lua | |
parent | b3e3ab0567a1a3c2f97de943ef9d7b24c0008979 (diff) | |
parent | 36d05845f7def1b8416f92dd4fc350276ed64636 (diff) | |
download | rneovim-37d5236f88810eb399732951ca32206dcc1915a3.tar.gz rneovim-37d5236f88810eb399732951ca32206dcc1915a3.tar.bz2 rneovim-37d5236f88810eb399732951ca32206dcc1915a3.zip |
Merge pull request #14511 from urandom/lsp_diagnostics_workspace_loclist
feat(lsp): add an option to lsp.diagnostic.set_loclist to the workspace
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) |