aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/api.txt15
-rw-r--r--runtime/lua/vim/lsp/codelens.lua11
2 files changed, 16 insertions, 10 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 1f97f38b54..242546f87d 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -1775,14 +1775,15 @@ nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()*
Dictionary containing command information, with these
keys:
• cmd: (string) Command name.
- • range: (number) Number of items in the command
- |<range>|. Can be 0, 1 or 2.
- • line1: (number) Starting line of command |<range>|. -1
- if command cannot take a range. |<line1>|
- • line2: (number) Final line of command |<range>|. -1 if
- command cannot take a range. |<line2>|
+ • range: (array) Command <range>. Can have 0-2 elements
+ depending on how many items the range contains. Has no
+ elements if command doesn't accept a range or if no
+ range was specified, one element if only a single range
+ item was specified and two elements if both range items
+ were specified.
• count: (number) Any |<count>| that was supplied to the
- command. -1 if command cannot take a count.
+ command. -1 if command cannot take a count. Mutually
+ exclusive with "range".
• reg: (number) The optional command |<register>|, if
specified. Empty string if not specified or if command
cannot take a register.
diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua
index 9eb64c9a2e..99695d2ed1 100644
--- a/runtime/lua/vim/lsp/codelens.lua
+++ b/runtime/lua/vim/lsp/codelens.lua
@@ -1,4 +1,5 @@
local util = require('vim.lsp.util')
+local log = require('vim.lsp.log')
local api = vim.api
local M = {}
@@ -214,7 +215,11 @@ end
--- |lsp-handler| for the method `textDocument/codeLens`
---
function M.on_codelens(err, result, ctx, _)
- assert(not err, vim.inspect(err))
+ if err then
+ active_refreshes[ctx.bufnr] = nil
+ local _ = log.error() and log.error("codelens", err)
+ return
+ end
M.save(result, ctx.bufnr, ctx.client_id)
@@ -222,8 +227,8 @@ function M.on_codelens(err, result, ctx, _)
-- once resolved.
M.display(result, ctx.bufnr, ctx.client_id)
resolve_lenses(result, ctx.bufnr, ctx.client_id, function()
- M.display(result, ctx.bufnr, ctx.client_id)
active_refreshes[ctx.bufnr] = nil
+ M.display(result, ctx.bufnr, ctx.client_id)
end)
end
@@ -245,7 +250,7 @@ function M.refresh()
return
end
active_refreshes[bufnr] = true
- vim.lsp.buf_request(0, 'textDocument/codeLens', params)
+ vim.lsp.buf_request(0, 'textDocument/codeLens', params, M.on_codelens)
end