add: default rust analizer config

This commit is contained in:
asep.komarudin 2024-06-29 13:31:00 +07:00
parent b2404fbb67
commit 22202bc11b
4 changed files with 41 additions and 11 deletions

View file

@ -1,6 +1,36 @@
local M = {}
if pcode.active_rust_config then
M = {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "rust" })
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.skip_config = opts.skip_config or {}
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "rust_analyzer" })
vim.list_extend(opts.skip_config, { "rust_analyzer" })
end,
},
{
"stevearc/conform.nvim",
event = "VeryLazy",
opts = function(_, opts)
local package = "ast-grep"
require("user.utils.masoncfg").try_install(package)
opts.formatters_by_ft.rust = { package }
end,
},
-- disable none-ls
{
"nvimtools/none-ls.nvim",
enabled = false,
},
{
"rust-lang/rust.vim",
ft = "rust",

View file

@ -52,11 +52,11 @@ _G.unique_list = function(list)
end
-- run if rust config true
if pcode.active_rust_config then
table.insert(pcode.mason_ensure_installed, "rust_analyzer")
table.insert(pcode.unregister_lsp, "rust_analyzer")
table.insert(pcode.treesitter_ensure_installed, "rust")
end
-- if pcode.active_rust_config then
-- table.insert(pcode.mason_ensure_installed, "rust_analyzer")
-- table.insert(pcode.unregister_lsp, "rust_analyzer")
-- table.insert(pcode.treesitter_ensure_installed, "rust")
-- end
-- run if javascript config true
-- if pcode.active_javascript_config.active then
-- local lst_ts = { "html", "javascript", "typescript", "tsx", "css", "json", "jsonc" }