Working on lsp
This commit is contained in:
parent
cec6b5ba89
commit
42a3ec0172
11 changed files with 127 additions and 25 deletions
|
@ -1,4 +1,6 @@
|
|||
# Plugins to look into
|
||||
- https://github.com/lvimuser/lsp-inlayhints.nvim/tree/anticonceal
|
||||
- https://github.com/theHamsta/nvim-dap-virtual-text/tree/inline-text
|
||||
- https://github.com/andythigpen/nvim-coverage
|
||||
- https://github.com/lukas-reineke/indent-blankline.nvim
|
||||
- https://github.com/johmsalas/text-case.nvim
|
||||
|
|
7
lua/plugins/colorpicker_ccc.lua
Normal file
7
lua/plugins/colorpicker_ccc.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"uga-rosa/ccc.nvim",
|
||||
event = "BufRead",
|
||||
keys = {
|
||||
{ "<leader>cp", ":CccPick <CR>", desc = "Color Picker" }
|
||||
},
|
||||
}
|
|
@ -3,32 +3,39 @@ return {
|
|||
branch = 'v2.x',
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{'neovim/nvim-lspconfig'},
|
||||
{ 'neovim/nvim-lspconfig' },
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
build = function()
|
||||
pcall(vim.cmd, 'MasonUpdate')
|
||||
end,
|
||||
},
|
||||
{'williamboman/mason-lspconfig.nvim'},
|
||||
{ 'williamboman/mason-lspconfig.nvim' },
|
||||
-- Autocompletion
|
||||
{'hrsh7th/nvim-cmp'},
|
||||
{'hrsh7th/cmp-nvim-lsp'},
|
||||
{'hrsh7th/cmp-buffer'},
|
||||
{'hrsh7th/cmp-path'},
|
||||
{'hrsh7th/cmp-cmdline'},
|
||||
{ 'hrsh7th/nvim-cmp' },
|
||||
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||
{ 'hrsh7th/cmp-buffer' },
|
||||
{ 'hrsh7th/cmp-path' },
|
||||
{ 'hrsh7th/cmp-cmdline' },
|
||||
-- Snips
|
||||
{'L3MON4D3/LuaSnip'},
|
||||
{ 'L3MON4D3/LuaSnip' },
|
||||
},
|
||||
config = function()
|
||||
local lsp = require('lsp-zero').preset({})
|
||||
local config = require 'lspconfig'
|
||||
local util = require 'lspconfig/util'
|
||||
local cmp = require 'cmp'
|
||||
local cmp_action = require('lsp-zero').cmp_action()
|
||||
|
||||
lsp.on_attach(function(_, bufnr)
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
capabilities = vim.tbl_deep_extend("keep", capabilities, vim.lsp.protocol.make_client_capabilities());
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
local on_attach = function(_, bufnr)
|
||||
lsp.default_keymaps({ buffer = bufnr })
|
||||
end)
|
||||
end
|
||||
|
||||
lsp.on_attach(on_attach)
|
||||
lsp.ensure_installed({
|
||||
-- -- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
|
||||
"lua_ls",
|
||||
|
@ -38,31 +45,44 @@ return {
|
|||
"cssls",
|
||||
"cssmodules_ls",
|
||||
"pyright",
|
||||
"prettierd",
|
||||
"html",
|
||||
"emmet_ls",
|
||||
"sqlls",
|
||||
"dockerls",
|
||||
"docker_compose_language_service",
|
||||
})
|
||||
|
||||
config.lua_ls.setup(lsp.nvim_lua_ls())
|
||||
|
||||
config.rust_analyzer.setup {}
|
||||
|
||||
config.tsserver.setup {}
|
||||
config.tsserver.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
root_dir = nvim_lsp.util.root_pattern("tsconfig.json", ".git"),
|
||||
|
||||
}
|
||||
config.eslint.setup {}
|
||||
config.cssls.setup {}
|
||||
config.cssmodules_ls.setup {}
|
||||
|
||||
config.pyright.setup {}
|
||||
|
||||
local cmp = require 'cmp'
|
||||
local cmp_action = require('lsp-zero').cmp_action()
|
||||
lsp.setup()
|
||||
|
||||
cmp.setup({
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
sources = {
|
||||
{ name = "path" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer", keyword_length = 3 },
|
||||
{ name = "luasnip", keyword_length= 2 },
|
||||
{ name = "nvim_lsp", priority = 1000 },
|
||||
{ name = "luasnip", priority = 750, keyword_length = 2 },
|
||||
{ name = "buffer", priority = 500, keyword_length = 3 },
|
||||
{ name = "path", priority = 250 },
|
||||
},
|
||||
mapping = {
|
||||
['<CR>'] = cmp.mapping.confirm({select = false}),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
||||
['<Tab>'] = cmp_action.tab_complete(),
|
||||
['<S-Tab>'] = cmp_action.select_prev_or_fallback(),
|
||||
-- Ctrl+Space to trigger completion menu
|
||||
|
@ -72,7 +92,6 @@ return {
|
|||
['<C-b>'] = cmp_action.luasnip_jump_backward(),
|
||||
}
|
||||
})
|
||||
lsp.setup()
|
||||
end,
|
||||
-- keys = {
|
||||
-- { "<leader>l", "<Nop>", desc = "LSP" },
|
||||
|
|
18
lua/plugins/lualine.lua
Normal file
18
lua/plugins/lualine.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
opts = {
|
||||
options = {
|
||||
theme = "codedark",
|
||||
section_separators = { left = '', right = '' },
|
||||
component_separators = '|',
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'filetype', 'filesize'},
|
||||
lualine_y = {'searchcount', 'selectioncount'},
|
||||
lualine_z = {'location'},
|
||||
},
|
||||
}
|
||||
}
|
46
lua/plugins/null-ls.lua
Normal file
46
lua/plugins/null-ls.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
-- npm install -g cspell@latest
|
||||
|
||||
local output = vim.fn.system {
|
||||
"which",
|
||||
"cspell",
|
||||
}
|
||||
if output == nil or output == "" then
|
||||
-- if v:shell_error != 0 then
|
||||
vim.fn.system {
|
||||
"npm",
|
||||
"install",
|
||||
"-g",
|
||||
"cspell@latest",
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
opts = function(_, config)
|
||||
-- config variable is the default definitions table for the setup function call
|
||||
local null_ls = require "null-ls"
|
||||
|
||||
-- Check supported formatters and linters
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
config.sources = {
|
||||
-- Set a formatter
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.formatting.rustfmt,
|
||||
-- null_ls.builtins.code_actions.proselint, -- TODO looks interesting
|
||||
null_ls.builtins.code_actions.cspell.with {
|
||||
config = {
|
||||
find_json = function() return vim.fn.findfile("cspell.json", vim.fn.environ().HOME .. "/.config/nvim/lua/user/;") end,
|
||||
},
|
||||
},
|
||||
null_ls.builtins.diagnostics.cspell.with {
|
||||
extra_args = { "--config", "~/.config/nvim/lua/user/cspell.json" },
|
||||
},
|
||||
}
|
||||
|
||||
config.update_in_insert = true
|
||||
|
||||
return config
|
||||
end,
|
||||
}
|
|
@ -53,6 +53,7 @@ return {
|
|||
"terraform",
|
||||
"toml",
|
||||
"tsx",
|
||||
"jsx",
|
||||
"typescript",
|
||||
"vue",
|
||||
"yaml",
|
||||
|
@ -60,7 +61,7 @@ return {
|
|||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end,
|
||||
-- disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
incremental_selection = { enable = true },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue