wip
This commit is contained in:
parent
bcdd3cdbd7
commit
ac80409bb9
10 changed files with 292 additions and 138 deletions
|
@ -42,12 +42,11 @@ return {
|
|||
|
||||
["<C-k>"] = { "select_prev", "fallback" },
|
||||
["<C-j>"] = { "select_next", "fallback" },
|
||||
["<C-q>"] = { "hide", "fallback" },
|
||||
["<C-n>"] = { "hide", "fallback" },
|
||||
|
||||
-- disable a keymap from the preset
|
||||
["<C-e>"] = {},
|
||||
["<C-p>"] = {},
|
||||
["<C-n>"] = {},
|
||||
|
||||
-- show with a list of providers
|
||||
-- ["<C-space>"] = {
|
||||
|
@ -79,6 +78,38 @@ return {
|
|||
-- Will be removed in a future release
|
||||
|
||||
use_nvim_cmp_as_default = true,
|
||||
kind_icons = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Property = "",
|
||||
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Struct = "",
|
||||
Module = "",
|
||||
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
EnumMember = "",
|
||||
|
||||
Keyword = "",
|
||||
Constant = "",
|
||||
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
},
|
||||
},
|
||||
|
||||
-- (Default) Only show the documentation popup when manually triggered
|
||||
|
@ -127,26 +158,26 @@ return {
|
|||
-- Maximum number of items to display
|
||||
max_items = 128,
|
||||
|
||||
selection = {
|
||||
-- When `true`, will automatically select the first item in the completion list
|
||||
preselect = true,
|
||||
-- preselect = function(ctx) return vim.bo.filetype ~= 'markdown' end,
|
||||
-- selection = {
|
||||
-- -- When `true`, will automatically select the first item in the completion list
|
||||
-- preselect = true,
|
||||
-- -- preselect = function(ctx) return vim.bo.filetype ~= 'markdown' end,
|
||||
--
|
||||
-- -- When `true`, inserts the completion item automatically when selecting it
|
||||
-- -- You may want to bind a key to the `cancel` command (default <C-e>) when using this option,
|
||||
-- -- which will both undo the selection and hide the completion menu
|
||||
-- auto_insert = true,
|
||||
-- -- auto_insert = function(ctx) return vim.bo.filetype ~= 'markdown' end
|
||||
-- },
|
||||
|
||||
-- When `true`, inserts the completion item automatically when selecting it
|
||||
-- You may want to bind a key to the `cancel` command (default <C-e>) when using this option,
|
||||
-- which will both undo the selection and hide the completion menu
|
||||
auto_insert = true,
|
||||
-- auto_insert = function(ctx) return vim.bo.filetype ~= 'markdown' end
|
||||
},
|
||||
|
||||
cycle = {
|
||||
-- When `true`, calling `select_next` at the _bottom_ of the completion list
|
||||
-- will select the _first_ completion item.
|
||||
from_bottom = true,
|
||||
-- When `true`, calling `select_prev` at the _top_ of the completion list
|
||||
-- will select the _last_ completion item.
|
||||
from_top = true,
|
||||
},
|
||||
-- cycle = {
|
||||
-- -- When `true`, calling `select_next` at the _bottom_ of the completion list
|
||||
-- -- will select the _first_ completion item.
|
||||
-- from_bottom = true,
|
||||
-- -- When `true`, calling `select_prev` at the _top_ of the completion list
|
||||
-- -- will select the _last_ completion item.
|
||||
-- from_top = true,
|
||||
-- },
|
||||
},
|
||||
|
||||
documentation = {
|
||||
|
@ -496,95 +527,174 @@ return {
|
|||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||
-- { "folke/neodev.nvim", opts = {} },
|
||||
},
|
||||
|
||||
config = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
-- (not in youtube nvim video)
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
mason_lspconfig.setup_handlers({
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["svelte"] = function()
|
||||
lspconfig["svelte"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = function(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = { "*.js", "*.ts" },
|
||||
callback = function(ctx)
|
||||
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
["graphql"] = function()
|
||||
lspconfig["graphql"].setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" },
|
||||
})
|
||||
end,
|
||||
["emmet_ls"] = function()
|
||||
lspconfig["emmet_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = {
|
||||
"html",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"css",
|
||||
"sass",
|
||||
"scss",
|
||||
"less",
|
||||
"svelte",
|
||||
},
|
||||
})
|
||||
end,
|
||||
["lua_ls"] = function()
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
opts = {
|
||||
servers = {
|
||||
lua_ls = {
|
||||
function()
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
bashls = {},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- local lspconfig = require("lspconfig")
|
||||
-- for server, config in pairs(opts.servers) do
|
||||
-- -- passing config.capabilities to blink.cmp merges with the capabilities in your
|
||||
-- -- `opts[server].capabilities, if you've defined it
|
||||
-- config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
|
||||
-- lspconfig[server].setup(config)
|
||||
-- end
|
||||
local servers = {
|
||||
html = {},
|
||||
awk_ls = {},
|
||||
shfmt = {
|
||||
filetypes = {
|
||||
"ab",
|
||||
},
|
||||
},
|
||||
bashls = {
|
||||
filetypes = {
|
||||
"bash",
|
||||
"sh",
|
||||
"zsh",
|
||||
},
|
||||
},
|
||||
lua_ls = {
|
||||
-- capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
["cssls"] = function()
|
||||
lspconfig["cssls"].setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { "css", "scss" },
|
||||
})
|
||||
end,
|
||||
["intelephense"] = function()
|
||||
lspconfig["intelephense"].setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { "php", "blade.php" },
|
||||
})
|
||||
end,
|
||||
-- ["tsserver"] = function()
|
||||
-- -- Replace tsserver with typescript-language-server
|
||||
-- lspconfig["typescript-language-server"].setup({
|
||||
-- capabilities = capabilities,
|
||||
-- filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" },
|
||||
-- })
|
||||
-- end,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
pyright = {
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
typeCheckingMode = "basic",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for name, opts in pairs(servers) do
|
||||
vim.lsp.enable(name) -- nvim v0.11.0 or above required
|
||||
vim.lsp.config(name, opts) -- nvim v0.11.0 or above required
|
||||
end
|
||||
end,
|
||||
|
||||
-- CAUTION:
|
||||
-- old config
|
||||
--
|
||||
-- config = function()
|
||||
-- local lspconfig = require("lspconfig")
|
||||
-- local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||
-- local mason_lspconfig = require("mason-lspconfig")
|
||||
--
|
||||
-- -- Change the Diagnostic symbols in the sign column (gutter)
|
||||
-- -- (not in youtube nvim video)
|
||||
-- local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
-- for type, icon in pairs(signs) do
|
||||
-- local hl = "DiagnosticSign" .. type
|
||||
-- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
-- end
|
||||
--
|
||||
-- mason_lspconfig.setup_handlers({
|
||||
-- function(server_name)
|
||||
-- lspconfig[server_name].setup({
|
||||
-- capabilities = capabilities,
|
||||
-- })
|
||||
-- end,
|
||||
-- ["svelte"] = function()
|
||||
-- lspconfig["svelte"].setup({
|
||||
-- capabilities = capabilities,
|
||||
-- on_attach = function(client, bufnr)
|
||||
-- vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
-- pattern = { "*.js", "*.ts" },
|
||||
-- callback = function(ctx)
|
||||
-- client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
|
||||
-- end,
|
||||
-- })
|
||||
-- end,
|
||||
-- })
|
||||
-- end,
|
||||
-- ["graphql"] = function()
|
||||
-- lspconfig["graphql"].setup({
|
||||
-- capabilities = capabilities,
|
||||
-- filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" },
|
||||
-- })
|
||||
-- end,
|
||||
-- ["emmet_ls"] = function()
|
||||
-- lspconfig["emmet_ls"].setup({
|
||||
-- capabilities = capabilities,
|
||||
-- filetypes = {
|
||||
-- "html",
|
||||
-- "typescriptreact",
|
||||
-- "javascriptreact",
|
||||
-- "css",
|
||||
-- "sass",
|
||||
-- "scss",
|
||||
-- "less",
|
||||
-- "svelte",
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- ["lua_ls"] = function()
|
||||
-- lspconfig["lua_ls"].setup({
|
||||
-- capabilities = capabilities,
|
||||
-- settings = {
|
||||
-- Lua = {
|
||||
-- diagnostics = {
|
||||
-- globals = { "vim" },
|
||||
-- },
|
||||
-- completion = {
|
||||
-- callSnippet = "Replace",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
-- end,
|
||||
-- ["cssls"] = function()
|
||||
-- lspconfig["cssls"].setup({
|
||||
-- capabilities = capabilities,
|
||||
-- filetypes = { "css", "scss" },
|
||||
-- })
|
||||
-- end,
|
||||
-- ["intelephense"] = function()
|
||||
-- lspconfig["intelephense"].setup({
|
||||
-- capabilities = capabilities,
|
||||
-- filetypes = { "php", "blade.php" },
|
||||
-- })
|
||||
-- end,
|
||||
-- -- ["tsserver"] = function()
|
||||
-- -- -- Replace tsserver with typescript-language-server
|
||||
-- -- lspconfig["typescript-language-server"].setup({
|
||||
-- -- capabilities = capabilities,
|
||||
-- -- filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" },
|
||||
-- -- })
|
||||
-- -- end,
|
||||
-- })
|
||||
-- end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -4,9 +4,6 @@ return {
|
|||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
},
|
||||
-- opts = {
|
||||
--
|
||||
-- }
|
||||
config = function()
|
||||
-- import mason
|
||||
local mason = require("mason")
|
||||
|
@ -54,13 +51,14 @@ return {
|
|||
end,
|
||||
ensure_installed = {
|
||||
"shfmt",
|
||||
"shellcheck",
|
||||
"bashls",
|
||||
"prettier",
|
||||
"stylua",
|
||||
"blade-formatter",
|
||||
"html-lsp",
|
||||
"docker-compose-language-service",
|
||||
"pylint",
|
||||
"eslint_d",
|
||||
-- "eslint_d",
|
||||
-- "blade-formatter",
|
||||
},
|
||||
})
|
||||
end,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue