nvim: add LSP status and mushroom to statusline
This commit is contained in:
parent
0f5675b963
commit
5850905a01
|
@ -116,4 +116,25 @@ function M.nerdfont_installed()
|
|||
return false
|
||||
end
|
||||
|
||||
-- return LSP status
|
||||
function M.lsp_status()
|
||||
local status = ''
|
||||
for _, msg in ipairs(require('lsp-status/messaging').messages()) do
|
||||
if msg.progress then
|
||||
status = '⏳'
|
||||
elseif msg.status then
|
||||
-- clangd parsing includes and whatnot
|
||||
if msg.content ~= 'idle' then
|
||||
status = '⌛'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local current_function = vim.b.lsp_current_function
|
||||
if current_function and current_function ~= '' then
|
||||
status = status .. '(' .. current_function .. ')'
|
||||
end
|
||||
return status
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -68,12 +68,19 @@ local on_attach = function(client, bufnr)
|
|||
-- callback = vim.lsp.buf.hover
|
||||
-- })
|
||||
-- end
|
||||
|
||||
require('lsp-status').on_attach(client)
|
||||
end
|
||||
|
||||
-- update client capabilities with completion plugin stuff
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(
|
||||
vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
-- progress capabilities
|
||||
local lsp_status = require('lsp-status')
|
||||
lsp_status.register_progress()
|
||||
capabilities = vim.tbl_extend('keep', capabilities, lsp_status.capabilities)
|
||||
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, {
|
||||
border = 'rounded',
|
||||
|
@ -84,7 +91,6 @@ vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
|||
-- setup servers
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
|
||||
if vim.fn.executable('clangd') > 0 then
|
||||
require("clangd_extensions").setup({
|
||||
server = {
|
||||
|
@ -94,8 +100,10 @@ if vim.fn.executable('clangd') > 0 then
|
|||
'--clang-tidy', -- needs >=clangd-9
|
||||
'--ranking-model=decision_forest' -- needs >=clangd-12
|
||||
},
|
||||
init_options = { clangdFileStatus = true },
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
capabilities = capabilities,
|
||||
handlers = lsp_status.extensions.clangd.setup(),
|
||||
},
|
||||
extensions = {
|
||||
inlay_hints = {
|
||||
|
|
|
@ -80,25 +80,24 @@ require('packer').startup(function(use)
|
|||
requires = {
|
||||
'https://github.com/nvim-lua/plenary.nvim',
|
||||
'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||
{
|
||||
'https://github.com/kyazdani42/nvim-web-devicons',
|
||||
cond = nerdfont_installed
|
||||
}
|
||||
{ 'https://github.com/kyazdani42/nvim-web-devicons',
|
||||
cond = nerdfont_installed }
|
||||
},
|
||||
}
|
||||
use {
|
||||
'https://github.com/kyazdani42/nvim-tree.lua',
|
||||
tag = '*',
|
||||
requires = {
|
||||
'https://github.com/kyazdani42/nvim-web-devicons',
|
||||
cond = nerdfont_installed
|
||||
{ 'https://github.com/kyazdani42/nvim-web-devicons',
|
||||
cond = nerdfont_installed }
|
||||
}
|
||||
}
|
||||
use {
|
||||
'https://github.com/nvim-lualine/lualine.nvim',
|
||||
requires = {
|
||||
'https://github.com/kyazdani42/nvim-web-devicons',
|
||||
cond = nerdfont_installed
|
||||
{ 'https://github.com/kyazdani42/nvim-web-devicons',
|
||||
cond = nerdfont_installed },
|
||||
'https://github.com/nvim-lua/lsp-status.nvim'
|
||||
}
|
||||
}
|
||||
use { 'https://codeberg.org/tastytea/bug-reference.nvim' }
|
||||
|
|
|
@ -73,10 +73,12 @@ require('lualine').setup({
|
|||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { { 'branch', icons_enabled = true }, 'diagnostics' },
|
||||
lualine_b = { { 'branch', icons_enabled = true },
|
||||
{ 'require("my.functions").lsp_status()', padding = 0 },
|
||||
'diagnostics' },
|
||||
lualine_c = { { 'filename', path = 1 } },
|
||||
lualine_x = { 'filetype' },
|
||||
lualine_y = { 'progress' },
|
||||
lualine_z = { 'location' }
|
||||
lualine_z = { 'location', { '"🍄"', padding = 0 } }
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue