feat(config): toggle rename notification
This commit is contained in:
parent
6aa3e10931
commit
f7d9085a5f
3 changed files with 20 additions and 11 deletions
|
@ -13,6 +13,9 @@ config.lsp = {
|
|||
-- true/false or table of filetypes {'.ts', '.js',}
|
||||
format_on_save = true,
|
||||
|
||||
-- set to false to disable rename notification
|
||||
rename_notification = false,
|
||||
|
||||
diagnostic = {
|
||||
-- disable diagnostic virtual text (see :h vim.diagnostic.config for all options)
|
||||
virtual_text = false,
|
||||
|
|
|
@ -17,6 +17,7 @@ local default_config = {
|
|||
},
|
||||
lsp = {
|
||||
format_on_save = true, -- true/false or table of filetypes {'.ts', '.js',}
|
||||
rename_notification = true,
|
||||
diagnostic = {
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
|
|
|
@ -8,6 +8,7 @@ function M.rename()
|
|||
local colors = require('cosmic.core.theme.colors')
|
||||
local icons = require('cosmic.core.theme.icons')
|
||||
local utils = require('cosmic.utils')
|
||||
local config = require('cosmic.config')
|
||||
local highlight = utils.highlight
|
||||
local prompt_str = ' ' .. icons.folder.arrow_closed .. ' '
|
||||
local map_opts = { noremap = true, silent = true }
|
||||
|
@ -55,6 +56,8 @@ function M.rename()
|
|||
method = select(2, ...)
|
||||
result = select(3, ...)
|
||||
end
|
||||
|
||||
if config.lsp.rename_notification then
|
||||
if err then
|
||||
vim.notify(("Error running LSP query '%s': %s"):format(method, err), vim.log.levels.ERROR)
|
||||
return
|
||||
|
@ -68,6 +71,8 @@ function M.rename()
|
|||
msg = msg:sub(1, #msg - 1)
|
||||
vim.notify(msg, vim.log.levels.INFO)
|
||||
end
|
||||
end
|
||||
|
||||
vim.lsp.handlers[method](...)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue