too many things
This commit is contained in:
@@ -1,64 +1,70 @@
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
-- integrated by default now?
|
||||
-- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
-- vim.keymap.set('n', "]d", vim.diagnostic.goto_next)
|
||||
-- vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
--vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
--vim.keymap.set('n', '<leader>K', vim.lsp.buf.hover, opts)
|
||||
--
|
||||
--vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
--vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
-- vim.api.nvim_create_autocmd("LspAttach", {
|
||||
-- group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
-- callback = function(ev)
|
||||
-- -- Enable completion triggered by <c-x><c-o>
|
||||
-- vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
-- vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
||||
-- vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
||||
-- vim.keymap.set("n", "<leader>le", vim.diagnostic.open_float)
|
||||
-- vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
-- vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
-- vim.keymap.set("n", "<leader>K", vim.lsp.buf.hover, opts)
|
||||
-- vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||
-- vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||
-- vim.keymap.set("n", "<leader>f", function() vim.lsp.buf.format({ async = true }) end, opts)
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
-- vim.keymap.set("n", "<leader>rr", vim.lsp.buf.rename, opts)
|
||||
-- vim.keymap.set("n", "<leader>le", vim.diagnostic.open_float)
|
||||
-- vim.keymap.set("n", "<leader>i", function()
|
||||
-- require("conform").format({ async = true })
|
||||
-- -- vim.lsp.buf.format { async = true } -- fallback if without conform
|
||||
-- end, opts)
|
||||
end,
|
||||
})
|
||||
-- put this in lsp_config
|
||||
-- require("mason").setup({})
|
||||
|
||||
require("lspconfig").rust_analyzer.setup({
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
imports = {
|
||||
granularity = {
|
||||
group = "module",
|
||||
},
|
||||
prefix = "self",
|
||||
},
|
||||
cargo = {
|
||||
buildScripts = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require("mason").setup({})
|
||||
require("mason-lspconfig").setup({
|
||||
-- Replace the language servers listed here
|
||||
-- with the ones you want to install
|
||||
ensure_installed = { "rust_analyzer", "ruff", "quick_lint_js", "html", "cssls", "lua_ls", "vimls" },
|
||||
})
|
||||
-- require("lint").linters_by_ft = {
|
||||
-- cpp = { "cpplint" },
|
||||
-- gdscript = { "gdtoolkit" },
|
||||
-- gitcommit = { "commitlint" },
|
||||
-- lua = { "ast-grep" },
|
||||
-- fish = { "fish_lsp" },
|
||||
-- markdown = {},
|
||||
-- sql = { "sqruff" },
|
||||
-- python = { "ruff" },
|
||||
-- r = { "r-languageserver" },
|
||||
-- javascript = { "eslint" },
|
||||
-- typescript = { "eslint" },
|
||||
-- }
|
||||
--
|
||||
-- require("lint").config = function()
|
||||
-- local lint = require("lint")
|
||||
-- vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
-- callback = function() lint.try_lint() end,
|
||||
-- })
|
||||
-- end
|
||||
|
||||
require("lint").linters_by_ft = {
|
||||
cpp = { "cpplint" },
|
||||
gdscript = { "gdtoolkit" },
|
||||
gitcommit = { "commitlint" },
|
||||
markdown = {},
|
||||
python = { "ruff" },
|
||||
}
|
||||
require("lint").config = function()
|
||||
local lint = require("lint")
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
end
|
||||
-- virtual text (not doing anything?)
|
||||
-- vim.lsp.handlers["textDocument/publishDiagnostic"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
-- virtual_text = true,
|
||||
-- })
|
||||
|
||||
-- local on_attach = function(client, bufnr)
|
||||
-- --- Only Neovim 0.7
|
||||
-- if client.resolved_capabilities.code_lens then
|
||||
-- local codelens = vim.api.nvim_create_augroup(
|
||||
-- 'LSPCodeLens',
|
||||
-- { clear = true }
|
||||
-- )
|
||||
-- vim.api.nvim_create_autocmd({ 'BufEnter' }, {
|
||||
-- group = codelens,
|
||||
-- callback = function()
|
||||
-- vim.lsp.codelens.refresh()
|
||||
-- end,
|
||||
-- buffer = bufnr,
|
||||
-- once = true,
|
||||
-- })
|
||||
-- vim.api.nvim_create_autocmd({ 'BufWritePost', 'CursorHold' }, {
|
||||
-- group = codelens,
|
||||
-- callback = function()
|
||||
-- vim.lsp.codelens.refresh()
|
||||
-- end,
|
||||
-- buffer = bufnr,
|
||||
-- })
|
||||
-- end
|
||||
-- end
|
||||
|
||||
Reference in New Issue
Block a user