Closed Shatur closed 4 years ago
Sorry, I missed than lsp_status.on_attach()
requires client
parameter:
on_attach = function(client)
apply_settings()
lsp_status.on_attach(client)
vim.api.nvim_buf_set_keymap(0, 'n', 'gs', '<Cmd>ClangdSwitchSourceHeader<CR>', {noremap=true, silent=true})
end
Glad to hear you figured it out! If you have suggestions for improvements to the docs to make that more clear, I'd welcome them.
I have a similar issue:
Error executing vim.schedule lua callback: ...ack/packer/start/lsp-status.nvim/lua/lsp-status/util.lua:62: table index is nil
this is my setup:
local nvim_status = require("lsp-status")
local status = {}
status.select_symbol = function(cursor_pos, symbol)
if symbol.valueRange then
local value_range = {
["start"] = {
character = 0,
line = vim.fn.byte2line(symbol.valueRange[1]),
},
["end"] = {
character = 0,
line = vim.fn.byte2line(symbol.valueRange[2]),
},
}
return require("lsp-status.util").in_range(cursor_pos, value_range)
end
end
status.activate = function()
nvim_status.register_progress()
nvim_status.config {
select_symbol = status.select_symbol
}
end
status.on_attach = function(client)
nvim_status.on_attach(client)
vim.cmd [[augroup dev_lsp_status]]
vim.cmd [[ autocmd CursorHold,BufEnter <buffer> lua require('lsp-status').update_current_function()]]
vim.cmd [[augroup END]]
end
return status
And here the usage in my lsp configuration:
local nvim_lsp = require('lspconfig')
local status = require("_lsp_status")
status.activate()
-- lsp config
local opts = {silent = true}
local custom_attach = function(client)
status.on_attach(client)
-- lsp keymaps below here
end
Hi @koopa1338: Please open a new issue for your bug, which appears to be distinct from the original issue in this thread.
Thank you for the awesome plugin! It works for me, but I have weird error in echo area:
Here is my configuration: