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