mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 01:26:46 +00:00
more extent
This commit is contained in:
@@ -52,17 +52,6 @@ end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
vim.lsp.config('*', {
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
semanticTokens = {
|
||||
multilineTokenSupport = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
root_markers = { '.git' },
|
||||
})
|
||||
|
||||
require('lazy').setup({ spec = { import = 'plugins' } }, {
|
||||
ui = {
|
||||
icons = vim.g.have_nerd_font and {} or {
|
||||
@@ -82,3 +71,78 @@ require('lazy').setup({ spec = { import = 'plugins' } }, {
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('blink.cmp').get_lsp_capabilities({}, false))
|
||||
|
||||
vim.lsp.config('*', {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.diagnostic.config {
|
||||
virtual_lines = {
|
||||
current_line = true,
|
||||
},
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||
callback = function(event)
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or 'n'
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||
end
|
||||
|
||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspDetach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
||||
callback = function(event2)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
map('<leader>th', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.lsp.enable {
|
||||
'clangd',
|
||||
'gopls',
|
||||
'luals',
|
||||
'pyright',
|
||||
'ruff',
|
||||
'rust-analyzer',
|
||||
'tsls',
|
||||
'yamlls',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user