aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/lsp.lua23
-rw-r--r--runtime/lua/vim/lsp/util.lua9
2 files changed, 18 insertions, 14 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index c7de2df25f..4c1c52c796 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -1017,21 +1017,18 @@ function lsp.get_log_path()
return log.get_filename()
end
-local function define_default_sign(name, properties)
- if not vim.fn.sign_getdefined(name) then
- vim.fn.sign_define(name, properties)
- end
-end
-
-- Define the LspDiagnostics signs if they're not defined already.
-local function define_default_lsp_diagnostics_signs()
- define_default_sign('LspDiagnosticsErrorSign', {text='E', texthl='LspDiagnosticsError', linehl='', numhl=''})
- define_default_sign('LspDiagnosticsWarningSign', {text='W', texthl='LspDiagnosticsWarning', linehl='', numhl=''})
- define_default_sign('LspDiagnosticsInformationSign', {text='I', texthl='LspDiagnosticsInformation', linehl='', numhl=''})
- define_default_sign('LspDiagnosticsHintSign', {text='H', texthl='LspDiagnosticsHint', linehl='', numhl=''})
+do
+ local function define_default_sign(name, properties)
+ if vim.tbl_isempty(vim.fn.sign_getdefined(name)) then
+ vim.fn.sign_define(name, properties)
+ end
+ end
+ define_default_sign('LspDiagnosticsErrorSign', {text='E', texthl='LspDiagnosticsErrorSign', linehl='', numhl=''})
+ define_default_sign('LspDiagnosticsWarningSign', {text='W', texthl='LspDiagnosticsWarningSign', linehl='', numhl=''})
+ define_default_sign('LspDiagnosticsInformationSign', {text='I', texthl='LspDiagnosticsInformationSign', linehl='', numhl=''})
+ define_default_sign('LspDiagnosticsHintSign', {text='H', texthl='LspDiagnosticsHintSign', linehl='', numhl=''})
end
-define_default_lsp_diagnostics_signs()
-
return lsp
-- vim:sw=2 ts=2 et
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 9a51bc2557..68f3b35df3 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -428,7 +428,13 @@ function M.jump_to_location(location)
local bufnr = vim.uri_to_bufnr(location.uri)
-- Save position in jumplist
vim.cmd "normal! m'"
- -- TODO(ashkan) use tagfunc here to update tagstack.
+
+ -- Push a new item into tagstack
+ local items = {}
+ table.insert(items, {tagname=vim.fn.expand("<cword>"), from=vim.fn.getpos('.')})
+ vim.fn.settagstack(vim.fn.bufnr('%'), {items=items}, 't')
+
+ --- Jump to new location
api.nvim_set_current_buf(bufnr)
local row = location.range.start.line
local col = location.range.start.character
@@ -673,6 +679,7 @@ do
table.insert(cmd_parts, k.."="..v)
end
api.nvim_command(table.concat(cmd_parts, ' '))
+ api.nvim_command('highlight link ' .. highlight_name .. 'Sign ' .. highlight_name)
severity_highlights[severity] = highlight_name
end