Fix tab width and insertion defaults.
This commit is contained in:
parent
e7547cf9e7
commit
e15bb92e27
11 changed files with 320 additions and 316 deletions
|
|
@ -6,102 +6,102 @@ require("lspconfig").ruff.setup({ capabilities = capabilities })
|
|||
require("lspconfig").ccls.setup({ capabilities = capabilities })
|
||||
|
||||
require("lspconfig").lua_ls.setup({
|
||||
on_init = function(client)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if
|
||||
path ~= vim.fn.stdpath("config")
|
||||
and (vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc"))
|
||||
then
|
||||
return
|
||||
end
|
||||
end
|
||||
on_init = function(client)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if
|
||||
path ~= vim.fn.stdpath("config")
|
||||
and (vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc"))
|
||||
then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {},
|
||||
},
|
||||
capabilities = capabilities,
|
||||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {},
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.g.rustaceanvim = {
|
||||
-- Plugin configuration
|
||||
-- tools = {
|
||||
-- },
|
||||
-- LSP configuration
|
||||
server = {
|
||||
-- on_attach = function(client, bufnr)
|
||||
-- -- you can also put keymaps in here
|
||||
--end,
|
||||
default_settings = {
|
||||
-- rust-analyzer language server configuration
|
||||
["rust-analyzer"] = {
|
||||
cargoWatch = true,
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
allTargets = false,
|
||||
loadOutDirsFromCheck = true,
|
||||
buildScripts = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
checkOnSave = {
|
||||
allFeatures = true,
|
||||
allTargets = false,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
ignored = {
|
||||
["async-trait"] = { "async_trait" },
|
||||
["napi-derive"] = { "napi" },
|
||||
["async-recursion"] = { "async_recursion" },
|
||||
},
|
||||
},
|
||||
files = {
|
||||
excludeDirs = {
|
||||
".direnv",
|
||||
".git",
|
||||
".github",
|
||||
".gitlab",
|
||||
"bin",
|
||||
"node_modules",
|
||||
"target",
|
||||
"venv",
|
||||
".venv",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- DAP configuration
|
||||
dap = {},
|
||||
-- Plugin configuration
|
||||
-- tools = {
|
||||
-- },
|
||||
-- LSP configuration
|
||||
server = {
|
||||
-- on_attach = function(client, bufnr)
|
||||
-- -- you can also put keymaps in here
|
||||
--end,
|
||||
default_settings = {
|
||||
-- rust-analyzer language server configuration
|
||||
["rust-analyzer"] = {
|
||||
cargoWatch = true,
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
allTargets = false,
|
||||
loadOutDirsFromCheck = true,
|
||||
buildScripts = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
checkOnSave = {
|
||||
allFeatures = true,
|
||||
allTargets = false,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
ignored = {
|
||||
["async-trait"] = { "async_trait" },
|
||||
["napi-derive"] = { "napi" },
|
||||
["async-recursion"] = { "async_recursion" },
|
||||
},
|
||||
},
|
||||
files = {
|
||||
excludeDirs = {
|
||||
".direnv",
|
||||
".git",
|
||||
".github",
|
||||
".gitlab",
|
||||
"bin",
|
||||
"node_modules",
|
||||
"target",
|
||||
"venv",
|
||||
".venv",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- DAP configuration
|
||||
dap = {},
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
|
||||
callback = function(args)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false, id = args.data.client_id })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
group = vim.api.nvim_create_augroup("lsp", { clear = true }),
|
||||
callback = function(args)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false, id = args.data.client_id })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue