Skip to content

Commit fab21b1

Browse files
committed
Updated breadcrump function
1 parent 2c8627d commit fab21b1

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

after/plugin/lsp.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,9 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities()
166166
vim.lsp.config('*', {
167167
capabilities = capabilities,
168168
root_markers = { '.git' },
169+
-- on_attach = function(client, bufnr)
170+
-- if client.server_capabilities.documentSymbolProvider then
171+
-- navic.attach(client, bufnr)
172+
-- end
173+
-- end
169174
})

after/plugin/nvim-navic.lua

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,25 @@ navic.setup {
4141
}
4242

4343
-- copy breadcrumb to clipboard
44-
keymap.set('n', '<leader>yb',
45-
function()
44+
keymap.set('n', '<leader>yb', function()
45+
local ok, err = pcall(function()
4646
local bufnr = vim.api.nvim_get_current_buf()
4747
local breadcrumb = ''
4848
if navic.is_available(bufnr) then
4949
local navic_data = navic.get_data(bufnr)
5050
for _, comp in ipairs(navic_data) do
51-
-- if comp.name contains '.' then put '' around it
51+
print(comp.name)
5252
if string.find(comp.name, '%.') then
53-
comp.name = '\'' .. comp.name .. '\''
53+
comp.name = "'" .. comp.name .. "'"
5454
end
5555
breadcrumb = breadcrumb .. '.' .. comp.name
5656
end
5757
end
5858
vim.fn.setreg('*', breadcrumb)
59-
end,
60-
{ noremap = true, silent = true, desc = 'Copy breadcrumb to clipboard' }
61-
)
59+
vim.notify('Breadcrumb copied: ' .. breadcrumb)
60+
end)
61+
62+
if not ok then
63+
vim.notify('Error: ' .. tostring(err), vim.log.levels.ERROR)
64+
end
65+
end, { noremap = true, silent = true, desc = 'Copy breadcrumb to clipboard' })

lua/lsp/helm_ls.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ vim.lsp.config('helm_ls', {
88
dynamicRegistration = true,
99
},
1010
},
11+
documentSymbolProvider = true,
1112
},
1213
settings = {
1314
['helm-ls'] = {

0 commit comments

Comments
 (0)