adopt neovim 0.12 native editing features
This commit is contained in:
parent
fa39d0a36c
commit
282e5e0f0b
18 changed files with 125 additions and 215 deletions
|
|
@ -1,12 +1,7 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
-- Load trusted project-local LSP settings from .nvim.lua.
|
||||
local function load_project_lsp_settings(server_name, root_dir)
|
||||
if not root_dir then
|
||||
|
|
@ -66,6 +61,13 @@ return {
|
|||
-- Setup keymaps for this buffer
|
||||
setup_keymaps(args.buf)
|
||||
|
||||
if client:supports_method("textDocument/completion") then
|
||||
vim.lsp.completion.enable(true, client.id, args.buf)
|
||||
if vim.fn.has("nvim-0.12") == 1 then
|
||||
vim.bo[args.buf].complete = "o^20"
|
||||
end
|
||||
end
|
||||
|
||||
-- Load and send project-specific settings
|
||||
local project_settings = load_project_lsp_settings(client.name, client.root_dir)
|
||||
if project_settings.settings then
|
||||
|
|
@ -88,13 +90,8 @@ return {
|
|||
local function configure(server_name, opts)
|
||||
opts = opts or {}
|
||||
|
||||
-- Merge with defaults
|
||||
local config = vim.tbl_deep_extend("force", {
|
||||
capabilities = capabilities,
|
||||
}, opts)
|
||||
|
||||
-- Configure the server using the new API
|
||||
vim.lsp.config(server_name, config)
|
||||
vim.lsp.config(server_name, opts)
|
||||
end
|
||||
|
||||
-- Configure all servers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue