migrate nvim config to 0.12.0: vim.pack, ui2, snacks -> mini, just general spring cleaning
This commit is contained in:
parent
d1178fbe59
commit
14b1a9b057
70 changed files with 1081 additions and 1483 deletions
|
|
@ -13,7 +13,7 @@ local function set_python_path(path)
|
|||
client.config.settings = vim.tbl_deep_extend("force", client.config.settings,
|
||||
{ python = { pythonPath = path } })
|
||||
end
|
||||
client.notify("workspace/didChangeConfiguration", { settings = nil })
|
||||
client:notify("workspace/didChangeConfiguration", { settings = nil })
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ local function switch_source_header()
|
|||
local bufnr = utils.validate_bufnr(0)
|
||||
local clangd_client = vim.lsp.get_clients({ bufnr = bufnr, name = "clangd" })[1]
|
||||
if clangd_client then
|
||||
clangd_client.request(
|
||||
clangd_client:request(
|
||||
"textDocument/switchSourceHeader",
|
||||
{ uri = vim.uri_from_bufnr(bufnr) },
|
||||
function(err, result)
|
||||
|
|
@ -13,13 +13,13 @@ local function switch_source_header()
|
|||
error(tostring(err))
|
||||
end
|
||||
if not result then
|
||||
print "Corresponding file cannot be determined"
|
||||
vim.notify("Corresponding file cannot be determined", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
vim.api.nvim_command("drop " .. vim.uri_to_fname(result))
|
||||
end, bufnr)
|
||||
else
|
||||
print "method textDocument/switchSourceHeader is not supported by any servers active on the current buffer"
|
||||
vim.notify("textDocument/switchSourceHeader is not supported by any servers active on the current buffer", vim.log.levels.WARN)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -44,9 +44,9 @@ return {
|
|||
"compile_flags.txt",
|
||||
"configure.ac",
|
||||
},
|
||||
on_attach = function()
|
||||
on_attach = function(_, bufnr)
|
||||
utils.set_keymap_list({
|
||||
{ "<leader>h", switch_source_header, },
|
||||
{ "<leader>h", switch_source_header, { buf = bufnr } },
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,10 @@ return {
|
|||
|
||||
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||
root_file_patterns = insert_package_json(root_file_patterns, "eslintConfig", fname)
|
||||
on_dir(vim.fs.dirname(vim.fs.find(root_file_patterns, { path = fname, upward = true })[1]))
|
||||
local root = vim.fs.find(root_file_patterns, { path = fname, upward = true })[1]
|
||||
if root then
|
||||
on_dir(vim.fs.dirname(root))
|
||||
end
|
||||
end,
|
||||
workspace_required = true,
|
||||
settings = {
|
||||
|
|
|
|||
|
|
@ -30,16 +30,12 @@ return {
|
|||
version = "LuaJIT"
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { "vim", "Snacks" },
|
||||
globals = { "vim" },
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
-- Depending on the usage, you might want to add additional paths here.
|
||||
-- "${3rd}/luv/library"
|
||||
-- "${3rd}/busted/library",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
-- Helper function for the 'MigrateToSvelte5' LSP command.
|
||||
-- This function will be called by the user command created in on_attach.
|
||||
local function migrate_to_svelte_5_command(client)
|
||||
client:exec_param({
|
||||
command = "migrate_to_svelte_5",
|
||||
arguments = { vim.uri_from_bufnr(vim.api.nvim_get_current_buf()) },
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
cmd = { "svelteserver", "--stdio" },
|
||||
|
||||
filetypes = { "svelte" },
|
||||
|
||||
root_markers = { "package.json", ".git/" },
|
||||
on_attach = function(client, bufnr)
|
||||
local fn = function() migrate_to_svelte_5_command(client) end
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "SvelteMigrateToSvelte5", fn, {
|
||||
desc = "Svelte: Migrate Component to Svelte 5 Syntax (via LSP).",
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
@ -63,9 +63,12 @@ return {
|
|||
-- ts_ls provides `source.*` code actions that apply to the whole file. These only appear in
|
||||
-- `vim.lsp.buf.code_action()` if specified in `context.only`.
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "LspTypescriptSourceAction", function()
|
||||
local kinds = vim.tbl_get(client.server_capabilities, "codeActionProvider", "codeActionKinds")
|
||||
if not kinds then return end
|
||||
|
||||
local source_actions = vim.tbl_filter(function(action)
|
||||
return vim.startswith(action, "source.")
|
||||
end, client.server_capabilities.codeActionProvider.codeActionKinds)
|
||||
end, kinds)
|
||||
|
||||
vim.lsp.buf.code_action({
|
||||
context = {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
return {
|
||||
cmd = { "zls" },
|
||||
on_new_config = function(new_config, new_root_dir)
|
||||
if vim.fn.filereadable(vim.fs.joinpath(new_root_dir, "zls.json")) ~= 0 then
|
||||
new_config.cmd = { "zls", "--config-path", "zls.json" }
|
||||
end
|
||||
if vim.fn.filereadable(vim.fs.joinpath(new_root_dir, "zls.json")) ~= 0 then
|
||||
new_config.cmd = { "zls", "--config-path", "zls.json" }
|
||||
end
|
||||
end,
|
||||
filetypes = { "zig", "zir" },
|
||||
root_markers = {"zls.json", "build.zig", ".git"},
|
||||
root_markers = { "zls.json", "build.zig", ".git" },
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue