summaryrefslogtreecommitdiff
path: root/lua/telescope/builtin/lsp.lua
diff options
context:
space:
mode:
authortami5 <kkharji@protonmail.com>2022-03-13 20:11:27 +0300
committerGitHub <noreply@github.com>2022-03-13 18:11:27 +0100
commitef7b6ada6d91a1b2932492d78c730e4fc00cd2ea (patch)
treedda4cb7cb3357724c83e85666bc8dc5c1ee2e898 /lua/telescope/builtin/lsp.lua
parent75b57304323861631519e204d9fbca7bdbf1c4c5 (diff)
feat: improve UX with vim.notify (#1763)
* fix(notify): don't report request on new line * ref(notify): update message format * ref(msgs): always quote values + decrease duplication * fix(ci): undefined variables * ref(actions): temporary silent actions.__index errors * cleanup * revert: panic effort, we continue to use error for those Co-authored-by: Simon Hauser <Simon-Hauser@outlook.de>
Diffstat (limited to 'lua/telescope/builtin/lsp.lua')
-rw-r--r--lua/telescope/builtin/lsp.lua49
1 files changed, 37 insertions, 12 deletions
diff --git a/lua/telescope/builtin/lsp.lua b/lua/telescope/builtin/lsp.lua
index 464caef..e22c670 100644
--- a/lua/telescope/builtin/lsp.lua
+++ b/lua/telescope/builtin/lsp.lua
@@ -117,7 +117,10 @@ lsp.document_symbols = function(opts)
end
if not result or vim.tbl_isempty(result) then
- print "No results from textDocument/documentSymbol"
+ utils.notify("builtin.lsp_document_symbols", {
+ msg = "No results from textDocument/documentSymbol",
+ level = "INFO",
+ })
return
end
@@ -129,7 +132,10 @@ lsp.document_symbols = function(opts)
end
if vim.tbl_isempty(locations) then
- print "locations table empty"
+ utils.notify("builtin.lsp_document_symbols", {
+ msg = "No document_symbol locations found",
+ level = "INFO",
+ })
return
end
@@ -165,12 +171,18 @@ lsp.code_actions = function(opts)
)
if err then
- print("ERROR: " .. err)
+ utils.notify("builin.lsp_code_actions", {
+ msg = err,
+ level = "ERROR",
+ })
return
end
if not results_lsp or vim.tbl_isempty(results_lsp) then
- print "No results from textDocument/codeAction"
+ utils.notify("builtin.lsp_document_symbols", {
+ msg = "No results from textDocument/codeAction",
+ level = "INFO",
+ })
return
end
@@ -206,7 +218,10 @@ lsp.code_actions = function(opts)
end
if #results == 0 then
- print "No code actions available"
+ utils.notify("builtin.lsp_document_symbols", {
+ msg = "No code actions available",
+ level = "INFO",
+ })
return
end
@@ -317,7 +332,10 @@ lsp.code_actions = function(opts)
then
client.request("codeAction/resolve", action, function(resolved_err, resolved_action)
if resolved_err then
- vim.notify(resolved_err.code .. ": " .. resolved_err.message, vim.log.levels.ERROR)
+ utils.notify("builtin.lsp_code_actions", {
+ msg = string.format("codeAction/resolve failed: %s : %s", resolved_err.code, resolved_err.message),
+ level = "ERROR",
+ })
return
end
if resolved_action then
@@ -358,10 +376,11 @@ lsp.workspace_symbols = function(opts)
end
if vim.tbl_isempty(locations) then
- print(
- "No results from workspace/symbol. Maybe try a different query: "
- .. "Telescope lsp_workspace_symbols query=example"
- )
+ utils.notify("builtin.lsp_workspace_symbols", {
+ msg = "No results from workspace/symbol. Maybe try a different query: "
+ .. "'Telescope lsp_workspace_symbols query=example'",
+ level = "INFO",
+ })
return
end
@@ -429,9 +448,15 @@ local function check_capabilities(feature, bufnr)
return true
else
if #clients == 0 then
- print "LSP: no client attached"
+ utils.notify("builtin.lsp_*", {
+ msg = "no client attached",
+ level = "INFO",
+ })
else
- print("LSP: server does not support " .. feature)
+ utils.notify("builtin.lsp_*", {
+ msg = "server does not support " .. feature,
+ level = "INFO",
+ })
end
return false
end