feat(nvim): update to v0.11
This commit is contained in:
@@ -1 +1 @@
|
|||||||
{"copilot.lua":"1.13.0"}
|
{"copilot.lua":"1.384.0"}
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
local configs = require 'lspconfig.configs'
|
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
|
|
||||||
configs.prolog_lsp = {
|
|
||||||
default_config = {
|
|
||||||
cmd = {"swipl",
|
|
||||||
"-g", "use_module(library(lsp_server)).",
|
|
||||||
"-g", "lsp_server:main",
|
|
||||||
"-t", "halt",
|
|
||||||
"--", "stdio"};
|
|
||||||
filetypes = {"prolog"};
|
|
||||||
root_dir = util.root_pattern("pack.pl");
|
|
||||||
};
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://github.com/jamesnvc/prolog_lsp
|
|
||||||
|
|
||||||
Prolog Language Server
|
|
||||||
]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,3 @@ require("olinpin.commands")
|
|||||||
|
|
||||||
-- this needs to be set after lazy
|
-- this needs to be set after lazy
|
||||||
vim.o.timeoutlen = 0
|
vim.o.timeoutlen = 0
|
||||||
-- setup prolog
|
|
||||||
require('lspconfig/prolog_lsp')
|
|
||||||
require('lspconfig').prolog_lsp.setup{}
|
|
||||||
-- require('olinpin.intro').open()
|
|
||||||
|
|||||||
@@ -1,40 +1,34 @@
|
|||||||
return {
|
return {
|
||||||
"stevearc/conform.nvim",
|
"stevearc/conform.nvim",
|
||||||
event = "BufWritePre",
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
opts = {
|
opts = {
|
||||||
lsp_fallback = true,
|
|
||||||
|
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
|
|
||||||
javascript = { "prettier" },
|
javascript = { "prettier" },
|
||||||
|
typescript = { "prettier" },
|
||||||
|
json = { "prettier" },
|
||||||
css = { "prettier" },
|
css = { "prettier" },
|
||||||
html = { "prettier" },
|
html = { "prettier" },
|
||||||
|
|
||||||
sh = { "shfmt" },
|
sh = { "shfmt" },
|
||||||
|
|
||||||
go = { "goimports", "gofumpt" },
|
go = { "goimports", "gofumpt" },
|
||||||
|
php = { "php-cs-fixer" },
|
||||||
|
python = { "black" },
|
||||||
},
|
},
|
||||||
|
|
||||||
-- format_on_save = function(bufnr)
|
format_on_save = false,
|
||||||
-- local filetype = vim.bo[bufnr].filetype
|
|
||||||
-- if filetype == "javascript" then
|
default_format_opts = { lsp_fallback = true },
|
||||||
-- return nil
|
|
||||||
-- end
|
|
||||||
-- if filetype == "vue" then
|
|
||||||
-- return nil
|
|
||||||
-- end
|
|
||||||
-- if filetype == "less" then
|
|
||||||
-- return nil
|
|
||||||
-- end
|
|
||||||
-- if filetype == "php" then
|
|
||||||
-- return nil
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- return {
|
|
||||||
-- timeout_ms = 500,
|
|
||||||
-- lsp_fallback = true,
|
|
||||||
-- }
|
|
||||||
-- end,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
config = function(_, opts)
|
||||||
|
require("conform").setup(opts)
|
||||||
|
|
||||||
|
-- manual formatting keymap
|
||||||
|
vim.keymap.set({ "n", "x" }, "=", function()
|
||||||
|
require("conform").format({
|
||||||
|
async = true,
|
||||||
|
lsp_fallback = true,
|
||||||
|
})
|
||||||
|
end, { desc = "Format file or range" })
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
return {
|
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
|
||||||
branch = 'v2.x',
|
|
||||||
dependencies = {
|
|
||||||
-- LSP Support
|
|
||||||
{'neovim/nvim-lspconfig'}, -- Required
|
|
||||||
{'williamboman/mason.nvim'}, -- Optional
|
|
||||||
{'williamboman/mason-lspconfig.nvim'}, -- Optional
|
|
||||||
|
|
||||||
-- Autocompletion
|
|
||||||
{'hrsh7th/nvim-cmp'}, -- Required
|
|
||||||
{'hrsh7th/cmp-nvim-lsp'}, -- Required
|
|
||||||
{'L3MON4D3/LuaSnip'}, -- Required
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local lsp = require('lsp-zero')
|
|
||||||
|
|
||||||
lsp.preset('recommended')
|
|
||||||
|
|
||||||
lsp.on_attach(function(client, bufnr)
|
|
||||||
-- see :help lsp-zero-keybindings
|
|
||||||
-- to learn the available actions
|
|
||||||
lsp.default_keymaps({buffer = bufnr})
|
|
||||||
end)
|
|
||||||
|
|
||||||
lsp.setup_servers({'ts_ls', 'eslint', 'html', 'hls', 'gopls'})
|
|
||||||
|
|
||||||
-- require("lspconfig").html.setup({
|
|
||||||
-- filetypes = { "html", "htmldjango" },
|
|
||||||
-- init_options = {
|
|
||||||
-- configurationSection = { "html", "css", "javascript" },
|
|
||||||
-- embeddedLanguages = {
|
|
||||||
-- css = true,
|
|
||||||
-- javascript = true,
|
|
||||||
-- },
|
|
||||||
-- provideFormatter = true,
|
|
||||||
-- },
|
|
||||||
-- })
|
|
||||||
|
|
||||||
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
|
|
||||||
lsp.set_sign_icons({
|
|
||||||
error = '✘',
|
|
||||||
warn = '▲',
|
|
||||||
hint = '⚑',
|
|
||||||
info = '»'
|
|
||||||
})
|
|
||||||
lsp.setup()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,145 @@
|
|||||||
|
-- Install LSP servers and 3rd-party tools
|
||||||
|
-- source: https://github.com/ruicsh/nvim-config/blob/main/lua/plugins/mason.lua
|
||||||
|
-- sauce: https://github.com/ruicsh/nvim-config/blob/main/lua/plugins/mason.lua
|
||||||
|
-- https://github.com/williamboman/mason.nvim
|
||||||
|
|
||||||
|
-- https://mason-registry.dev/registry/list
|
||||||
|
local PACKAGES = {
|
||||||
|
-- LSP
|
||||||
|
"angular-language-server",
|
||||||
|
"ansible-language-server",
|
||||||
|
"css-lsp",
|
||||||
|
"cssmodules-language-server",
|
||||||
|
"css-variables-language-server",
|
||||||
|
"dockerfile-language-server",
|
||||||
|
"harper-ls",
|
||||||
|
"html-lsp",
|
||||||
|
"json-lsp",
|
||||||
|
"lua-language-server",
|
||||||
|
"pyright",
|
||||||
|
"typescript-language-server",
|
||||||
|
"yaml-language-server",
|
||||||
|
-- Format
|
||||||
|
"black",
|
||||||
|
"flake8",
|
||||||
|
"prettierd",
|
||||||
|
"stylua",
|
||||||
|
-- Lint
|
||||||
|
"eslint-lsp",
|
||||||
|
"pylint",
|
||||||
|
"jq",
|
||||||
|
"php-cs-fixer",
|
||||||
|
"intelephense",
|
||||||
|
"prettier",
|
||||||
|
}
|
||||||
|
|
||||||
|
local function install(pack, version)
|
||||||
|
local notifyOpts = { title = "Mason", icon = "", id = "mason.install" }
|
||||||
|
|
||||||
|
local msg = version and ("[%s] updating to %s…"):format(pack.name, version)
|
||||||
|
or ("[%s] installing…"):format(pack.name)
|
||||||
|
vim.defer_fn(function()
|
||||||
|
vim.notify(msg, nil, notifyOpts)
|
||||||
|
end, 0)
|
||||||
|
|
||||||
|
pack:once("install:success", function()
|
||||||
|
local msg2 = ("[%s] %s"):format(pack.name, version and "updated." or "installed.")
|
||||||
|
notifyOpts.icon = " "
|
||||||
|
vim.defer_fn(function()
|
||||||
|
vim.notify(msg2, nil, notifyOpts)
|
||||||
|
end, 0)
|
||||||
|
end)
|
||||||
|
|
||||||
|
pack:once("install:failed", function()
|
||||||
|
local error = "Failed to install [" .. pack.name .. "]"
|
||||||
|
vim.defer_fn(function()
|
||||||
|
vim.notify(error, vim.log.levels.ERROR, notifyOpts)
|
||||||
|
end, 0)
|
||||||
|
end)
|
||||||
|
|
||||||
|
pack:install({ version = version })
|
||||||
|
end
|
||||||
|
|
||||||
|
local function syncPackages(ensurePacks)
|
||||||
|
local masonReg = require("mason-registry")
|
||||||
|
|
||||||
|
local function refreshCallback()
|
||||||
|
-- Auto-install missing packages & auto-update installed ones
|
||||||
|
vim.iter(ensurePacks):each(function(packName)
|
||||||
|
-- Extract package name and pinned version if specified
|
||||||
|
local name, pinnedVersion = packName:match("([^@]+)@?(.*)")
|
||||||
|
if not masonReg.has_package(name) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local pack = masonReg.get_package(name)
|
||||||
|
if pack:is_installed() then
|
||||||
|
-- Only check for updates if no version was pinned
|
||||||
|
if pinnedVersion == "" then
|
||||||
|
local latest_version = pack:get_latest_version()
|
||||||
|
-- Check if the latest version is different from the installed one
|
||||||
|
if latest_version and latest_version ~= pack:get_installed_version() then
|
||||||
|
local msg = ("[%s] updating to %s…"):format(pack.name, latest_version)
|
||||||
|
vim.defer_fn(function()
|
||||||
|
vim.notify(msg, nil, { title = "Mason", icon = "" })
|
||||||
|
end, 0)
|
||||||
|
-- Install the latest version
|
||||||
|
pack:install({ version = latest_version })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- Install with pinned version if specified
|
||||||
|
install(pack, pinnedVersion ~= "" and pinnedVersion or nil)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Auto-clean unused packages
|
||||||
|
local installedPackages = masonReg.get_installed_package_names()
|
||||||
|
vim.iter(installedPackages):each(function(packName)
|
||||||
|
-- Check if installed package is in our ensure list (without version suffix)
|
||||||
|
local isEnsured = vim.iter(ensurePacks):any(function(ensurePack)
|
||||||
|
local name = ensurePack:match("([^@]+)")
|
||||||
|
return name == packName
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not isEnsured then
|
||||||
|
masonReg.get_package(packName):uninstall()
|
||||||
|
local msg = ("[%s] uninstalled."):format(packName)
|
||||||
|
vim.defer_fn(function()
|
||||||
|
vim.notify(msg, nil, { title = "Mason", icon = "" })
|
||||||
|
end, 0)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
masonReg.refresh(refreshCallback)
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
config = function()
|
init = function()
|
||||||
require("mason").setup()
|
-- Do not crowd home directory with NPM cache folder
|
||||||
|
vim.env.npm_config_cache = vim.env.HOME .. "/.cache/npm"
|
||||||
|
end,
|
||||||
|
opts = {
|
||||||
|
ui = {
|
||||||
|
border = "rounded",
|
||||||
|
height = 0.85,
|
||||||
|
width = 0.8,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("mason").setup(opts)
|
||||||
|
|
||||||
|
-- Filter out disabled packages
|
||||||
|
local packages = {}
|
||||||
|
for _, package in ipairs(PACKAGES) do
|
||||||
|
table.insert(packages, package)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vim.defer_fn(function()
|
||||||
|
syncPackages(packages)
|
||||||
|
end, 3000)
|
||||||
|
end,
|
||||||
|
|
||||||
|
event = { "VeryLazy" },
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
return {
|
|
||||||
"jay-babu/mason-null-ls.nvim",
|
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
|
||||||
dependencies = {
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
"jose-elias-alvarez/null-ls.nvim",
|
|
||||||
},
|
|
||||||
config = function ()
|
|
||||||
|
|
||||||
require("mason-null-ls").setup({
|
|
||||||
ensure_installed = {
|
|
||||||
"stylua",
|
|
||||||
"jq",
|
|
||||||
"php-cs-fixer",
|
|
||||||
"intelephense",
|
|
||||||
"black",
|
|
||||||
"prettier",
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
local null_ls = require("null-ls")
|
|
||||||
local format = null_ls.builtins.formatting
|
|
||||||
|
|
||||||
null_ls.setup({
|
|
||||||
sources = {
|
|
||||||
format.black,
|
|
||||||
format.stylua,
|
|
||||||
format.prettier
|
|
||||||
}
|
|
||||||
})
|
|
||||||
vim.keymap.set({"n", "x"}, "=", function() vim.cmd('LspZeroFormat') end, { desc = "Format" })
|
|
||||||
end
|
|
||||||
}
|
|
||||||
@@ -45,13 +45,6 @@ return {
|
|||||||
additional_vim_regex_highlighting = {"markdown"}
|
additional_vim_regex_highlighting = {"markdown"}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
require'lspconfig'.sourcekit.setup{
|
|
||||||
cmd = {'/usr/bin/sourcekit-lsp'}
|
|
||||||
}
|
|
||||||
require('lspconfig')['hls'].setup{
|
|
||||||
filetypes = { 'haskell', 'lhaskell', 'cabal' },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- vim.keymap.set('n','gd',vim.lsp.buf.definition)
|
-- vim.keymap.set('n','gd',vim.lsp.buf.definition)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user