fix rust analyzer

This commit is contained in:
Robot 2023-12-18 17:12:10 -08:00
parent 9c0cdd3249
commit b3ea8e685e
4 changed files with 37 additions and 17 deletions

View File

@ -20,13 +20,15 @@ vim.cmd.colorscheme(colorscheme)
vim.api.nvim_set_hl(0, "String", { fg = "#9ece6a", underline = false, bold = false })
vim.api.nvim_set_hl(0, "Type", { fg = "#00ff00", underline = false, bold = false })
vim.api.nvim_set_hl(0, "Structure", { fg = "#00ff00", underline = false, bold = false })
vim.api.nvim_set_hl(0, "Constant", { fg = "#00ff00", underline = false, bold = false })
vim.api.nvim_set_hl(0, "Constant", { fg = "#fab387", underline = false, bold = true })
vim.api.nvim_set_hl(0, "@lsp.type.selfKeyword.rust", {fg = "#b00202", bold = true, underline=false})
vim.api.nvim_set_hl(0, "@lsp.type.typeParamater.rust", {fg = "#ffbf00", bold = true, underline=false})
vim.api.nvim_set_hl(0, "Identifier", { fg = "#ffffff", underline = false, bold = false })
vim.api.nvim_set_hl(0, "Function", { fg = "#025fb0", underline = false, bold = false })
vim.api.nvim_set_hl(0, "@lsp.typemod.variable.constant.rust", { fg = "#00ff00", underline = false, bold = false })
vim.api.nvim_set_hl(0, "@lsp.type.enumMember.rust", { fg = "#fab387", underline = false, bold = false })
vim.api.nvim_set_hl(0, "@lsp.type.interface", {fg = "#a402b0", bold = true, underline=false})
vim.api.nvim_set_hl(0, "Comment", {fg = "#989898", bold = false, underline=false})
vim.api.nvim_set_hl(0, "NvimTreeGitDirty", {fg = "#ffaa00", bold = false, underline=false})
vim.api.nvim_set_hl(0, "@string.escape", {fg = "#aa00ff", bold = false, underline=false})
vim.api.nvim_set_hl(0, "@type.builtin", {fg = "#00ff00", bold = false, underline=false})
-- vim.api.nvim_set_hl(0, "DiagnosticUnnecessary", {})

View File

@ -10,10 +10,17 @@ return {
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
-- "zbirenbaum/copilot.lua",
-- "zbirenbaum/copilot-cmp",
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
-- require("copilot").setup({
-- suggestion = { enabled = false },
-- panel = { enabled = false },
-- })
-- require("copilot-cmp")
require("luasnip/loaders/from_vscode").lazy_load()
@ -43,7 +50,13 @@ return {
Event = "",
Operator = "",
TypeParameter = "",
-- Copilot = "",
}
-- local has_words_before = function()
-- if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
-- local line, col = unpack(vim.api.nvim_win_get_cursor(0))
-- return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil
-- end
cmp.setup({
snippet = {

View File

@ -9,7 +9,7 @@ return {
"folke/neodev.nvim",
"RRethy/vim-illuminate",
"hrsh7th/cmp-nvim-lsp",
"simrat39/rust-tools.nvim",
-- "simrat39/rust-tools.nvim",
},
config = function()
-- Set up Mason before anything else
@ -18,6 +18,7 @@ return {
ensure_installed = {
"lua_ls",
"pylsp",
"rust_analyzer",
},
automatic_installation = true,
})
@ -143,20 +144,25 @@ return {
},
},
})
local rt = require("rust-tools")
rt.setup({
server = {
on_attach= function(_, bufnr)
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, {buffer = bufnr})
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, {buffer = bufnr})
end,
},
tools = {
inlay_hints = {
auto = false,
},
}
-- Rust
require("lspconfig")["rust_analyzer"].setup({
on_attach = on_attach,
capabilities = capabilities,
})
-- local rt = require("rust-tools")
-- rt.setup({
-- server = {
-- on_attach= function(_, bufnr)
-- vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, {buffer = bufnr})
-- vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, {buffer = bufnr})
-- end,
-- },
-- tools = {
-- inlay_hints = {
-- auto = false,
-- },
-- }
-- })
end,
},
}

View File

@ -42,7 +42,6 @@ return {
vim.keymap.set('n', '<leader>t', '<cmd>SymbolsOutline<cr>')
end
},
"simrat39/rust-tools.nvim",
}