updated to 0.11
This commit is contained in:
parent
d98548a231
commit
98ea49a70f
|
@ -1,33 +1,24 @@
|
||||||
-- [[ Configure LSP ]]
|
require('mason').setup()
|
||||||
local lsp = require 'lsp-zero'
|
require('mason-lspconfig').setup()
|
||||||
|
|
||||||
lsp.preset 'recommended'
|
vim.lsp.enable 'rust_analyzer'
|
||||||
|
vim.lsp.enable 'pyright'
|
||||||
|
|
||||||
lsp.ensure_installed {
|
vim.lsp.enable 'jdtls'
|
||||||
'rust_analyzer',
|
|
||||||
-- Python
|
vim.lsp.enable 'lua_ls'
|
||||||
-- 'mypy',
|
|
||||||
-- 'black',
|
vim.lsp.enable 'gopls'
|
||||||
-- 'isort',
|
vim.lsp.enable 'templ'
|
||||||
-- 'ruff_lsp',
|
vim.lsp.enable 'htmx'
|
||||||
'pyright',
|
|
||||||
-- Java Stuffs
|
vim.lsp.enable 'jsonls'
|
||||||
'jdtls',
|
vim.lsp.enable 'html'
|
||||||
-- 'google-java-format',
|
|
||||||
-- Golang
|
vim.lsp.enable 'ts_ls'
|
||||||
-- 'gofumpt',
|
vim.lsp.enable 'eslint'
|
||||||
-- 'goimports-reviser',
|
|
||||||
-- 'golines',
|
vim.lsp.enable 'tailwindcss'
|
||||||
'gopls',
|
|
||||||
'templ',
|
|
||||||
'htmx',
|
|
||||||
-- Typescript
|
|
||||||
-- 'prettier',
|
|
||||||
-- 'prettierd',
|
|
||||||
-- 'tsserver',
|
|
||||||
-- Others
|
|
||||||
'tailwindcss',
|
|
||||||
}
|
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities.textDocument.foldingRange = {
|
capabilities.textDocument.foldingRange = {
|
||||||
|
@ -35,100 +26,104 @@ capabilities.textDocument.foldingRange = {
|
||||||
lineFoldingOnly = true,
|
lineFoldingOnly = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function on_attach(bufnr)
|
||||||
|
local opts = { buffer = bufnr, remap = false }
|
||||||
|
|
||||||
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||||
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vws', vim.lsp.buf.workspace_symbol, opts)
|
||||||
|
vim.keymap.set('n', '<leader>vd', vim.diagnostic.open_float, opts)
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_next, opts)
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_prev, opts)
|
||||||
|
vim.keymap.set('n', '<leader>dd', vim.diagnostic.setloclist, opts)
|
||||||
|
vim.keymap.set('n', '<leader>do', vim.diagnostic.open_float, opts)
|
||||||
|
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
|
||||||
|
vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, opts)
|
||||||
|
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts)
|
||||||
|
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
||||||
|
vim.keymap.set('n', '<leader>lf', function()
|
||||||
|
require('conform').format()
|
||||||
|
end, { buffer = bufnr, desc = 'Format Buffer' })
|
||||||
|
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||||
|
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
|
vim.keymap.set('n', '<leader>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||||
|
callback = function(ev)
|
||||||
|
on_attach(ev.buf)
|
||||||
|
-- local map = function(keys, func, desc)
|
||||||
|
-- vim.keymap.set('n', keys, func, { buffer = ev.buf, desc = 'Lsp: ' .. desc })
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- local tele = require 'telescope.builtin'
|
||||||
|
-- map('gd', tele.lsp_definitions, 'Goto Definition')
|
||||||
|
-- map('gr', tele.lsp_references, 'Goto References')
|
||||||
|
--
|
||||||
|
-- map('K', vim.lsp.buf.hover, 'hover')
|
||||||
|
--
|
||||||
|
-- map('n', '<leader>vws', vim.lsp.buf.workspace_symbol, 'Workspace Symbols')
|
||||||
|
--
|
||||||
|
-- map('n', '<leader>vd', vim.diagnostic.open_float, 'View Diagnostic')
|
||||||
|
--
|
||||||
|
-- map('n', '[d', vim.diagnostic.goto_next, 'Goto Next Diagnostic')
|
||||||
|
-- map('n', ']d', vim.diagnostic.goto_prev, 'Goto Preview Diagnostic')
|
||||||
|
-- map('n', '<leader>dd', vim.diagnostic.setloclist, 'List Diagnostics')
|
||||||
|
-- map('n', '<leader>do', vim.diagnostic.open_float, 'List All Diagnostics')
|
||||||
|
-- map('n', '<leader>ca', vim.lsp.buf.code_action, 'Code Action')
|
||||||
|
--
|
||||||
|
-- map('<leader>fs', tele.lsp_document_symbols, 'Doc Symbols')
|
||||||
|
-- map('<leader>fS', tele.lsp_dynamic_workspace_symbols, 'Dynamic Symbols')
|
||||||
|
-- map('<leader>ft', tele.lsp_type_definitions, 'Goto Type')
|
||||||
|
-- map('<leader>fi', tele.lsp_implementations, 'Goto Impl')
|
||||||
|
--
|
||||||
|
-- map('n', '<leader>rn', vim.lsp.buf.rename, 'Rename')
|
||||||
|
-- map('n', '<leader>lf', function()
|
||||||
|
-- require('conform').format()
|
||||||
|
-- end, 'Format Buffer')
|
||||||
|
--
|
||||||
|
-- map('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, 'Add WorkSpace')
|
||||||
|
-- map('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, 'Remove WorkSpace')
|
||||||
|
-- map('n', '<leader>wl', function()
|
||||||
|
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
-- end, 'List Work Spaces')
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
-- vim.lsp.on_attach(on_attach)
|
||||||
|
-- vim.lsp.setup()
|
||||||
|
--
|
||||||
|
-- vim.diagnostic.config {
|
||||||
|
-- virtual_text = true,
|
||||||
|
-- }
|
||||||
|
|
||||||
-- Fix Undefined global 'vim'
|
-- Fix Undefined global 'vim'
|
||||||
lsp.nvim_workspace()
|
-- vim.lsp.nvim_workspace()
|
||||||
|
|
||||||
local cmp = require 'cmp'
|
-- local cmp = require 'cmp'
|
||||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
-- local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||||
local cmp_mappings = lsp.defaults.cmp_mappings {
|
-- local cmp_mappings = vim.lsp.defaults.cmp_mappings {
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
-- ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
-- ['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
-- ['<C-Space>'] = cmp.mapping.complete(),
|
||||||
}
|
-- }
|
||||||
|
|
||||||
cmp_mappings['<Tab>'] = nil
|
-- cmp_mappings['<Tab>'] = nil
|
||||||
cmp_mappings['<S-Tab>'] = nil
|
-- cmp_mappings['<S-Tab>'] = nil
|
||||||
|
|
||||||
lsp.setup_nvim_cmp {
|
-- vim.lsp.setup_nvim_cmp {
|
||||||
mapping = cmp_mappings,
|
-- mapping = cmp_mappings,
|
||||||
}
|
-- }
|
||||||
|
|
||||||
lsp.set_preferences {
|
-- vim.lsp.set_preferences {
|
||||||
suggest_lsp_servers = false,
|
-- suggest_lsp_servers = false,
|
||||||
sign_icons = {
|
-- sign_icons = {
|
||||||
error = '⛔️',
|
-- error = '⛔️',
|
||||||
warn = '⚠️',
|
-- warn = '⚠️',
|
||||||
hint = '🧐',
|
-- hint = '🧐',
|
||||||
info = 'I',
|
-- info = 'I',
|
||||||
},
|
-- },
|
||||||
}
|
-- }
|
||||||
|
|
||||||
local function on_attach(client, bufnr)
|
|
||||||
local opts = { buffer = bufnr, remap = false }
|
|
||||||
|
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
|
||||||
vim.keymap.set('n', '<leader>vws', vim.lsp.buf.workspace_symbol, opts)
|
|
||||||
vim.keymap.set('n', '<leader>vd', vim.diagnostic.open_float, opts)
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_next, opts)
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_prev, opts)
|
|
||||||
vim.keymap.set('n', '<leader>dd', vim.diagnostic.setloclist, opts)
|
|
||||||
vim.keymap.set('n', '<leader>do', vim.diagnostic.open_float, opts)
|
|
||||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
|
|
||||||
vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, opts)
|
|
||||||
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts)
|
|
||||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
|
||||||
vim.keymap.set('n', '<leader>lf', function()
|
|
||||||
require('conform').format()
|
|
||||||
end, { buffer = bufnr, desc = 'Format Buffer' })
|
|
||||||
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
|
|
||||||
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
|
||||||
vim.keymap.set('n', '<leader>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
lsp.on_attach(on_attach)
|
|
||||||
lsp.setup()
|
|
||||||
|
|
||||||
vim.diagnostic.config {
|
|
||||||
virtual_text = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
local function on_attach(client, bufnr)
|
|
||||||
local opts = { buffer = bufnr, remap = false }
|
|
||||||
|
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
|
||||||
vim.keymap.set('n', '<leader>vws', vim.lsp.buf.workspace_symbol, opts)
|
|
||||||
vim.keymap.set('n', '<leader>vd', vim.diagnostic.open_float, opts)
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_next, opts)
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_prev, opts)
|
|
||||||
vim.keymap.set('n', '<leader>dd', vim.diagnostic.setloclist, opts)
|
|
||||||
vim.keymap.set('n', '<leader>do', vim.diagnostic.open_float, opts)
|
|
||||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
|
|
||||||
vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, opts)
|
|
||||||
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts)
|
|
||||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
|
||||||
vim.keymap.set('n', '<leader>lf', function()
|
|
||||||
require('conform').format()
|
|
||||||
end, { buffer = bufnr, desc = 'Format Buffer' })
|
|
||||||
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
|
|
||||||
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
|
||||||
vim.keymap.set('n', '<leader>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
lsp.on_attach(on_attach)
|
|
||||||
lsp.setup()
|
|
||||||
|
|
||||||
vim.diagnostic.config {
|
|
||||||
virtual_text = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
}
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
require('mason').setup({})
|
|
|
@ -3,9 +3,11 @@
|
||||||
"alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" },
|
"alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" },
|
||||||
"catppuccin": { "branch": "main", "commit": "387b4b19568cbda82c1d6def9ded31fd6ae7fb99" },
|
"catppuccin": { "branch": "main", "commit": "387b4b19568cbda82c1d6def9ded31fd6ae7fb99" },
|
||||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||||
|
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||||
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
|
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
|
||||||
|
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" },
|
"conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" },
|
||||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||||
|
@ -15,7 +17,6 @@
|
||||||
"image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" },
|
"image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
"lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" },
|
"lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" },
|
||||||
"lsp-zero.nvim": { "branch": "v1.x", "commit": "a7c18ecde0b4462bcd84f363723ff633f2c9a198" },
|
|
||||||
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||||
"lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" },
|
"lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" },
|
"lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" },
|
||||||
|
@ -56,5 +57,6 @@
|
||||||
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
|
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
|
||||||
"vim-rhubarb": { "branch": "master", "commit": "386daa2e9d98e23e27ad089afcbe5c5a903e488d" },
|
"vim-rhubarb": { "branch": "master", "commit": "386daa2e9d98e23e27ad089afcbe5c5a903e488d" },
|
||||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||||
|
"vim-vsnip": { "branch": "master", "commit": "0a4b8419e44f47c57eec4c90df17567ad4b1b36e" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
return {
|
return {
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
'neovim/nvim-lspconfig',
|
||||||
branch = 'v1.x',
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- LSP Support
|
-- LSP Support
|
||||||
{ 'neovim/nvim-lspconfig' },
|
|
||||||
{ 'williamboman/mason.nvim' },
|
{ 'williamboman/mason.nvim' },
|
||||||
{ 'williamboman/mason-lspconfig.nvim' },
|
{ 'williamboman/mason-lspconfig.nvim' },
|
||||||
|
|
||||||
|
@ -14,6 +12,9 @@ return {
|
||||||
{ 'saadparwaiz1/cmp_luasnip' },
|
{ 'saadparwaiz1/cmp_luasnip' },
|
||||||
{ 'hrsh7th/cmp-nvim-lsp' },
|
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||||
{ 'hrsh7th/cmp-nvim-lua' },
|
{ 'hrsh7th/cmp-nvim-lua' },
|
||||||
|
{ 'hrsh7th/cmp-cmdline' },
|
||||||
|
{ 'hrsh7th/cmp-vsnip' },
|
||||||
|
{ 'hrsh7th/vim-vsnip' },
|
||||||
|
|
||||||
-- Snippets
|
-- Snippets
|
||||||
{ 'L3MON4D3/LuaSnip' },
|
{ 'L3MON4D3/LuaSnip' },
|
||||||
|
|
Loading…
Reference in New Issue