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, "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, "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, "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.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, "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, "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, "@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, "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, "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, "@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, "@type.builtin", {fg = "#00ff00", bold = false, underline=false})
-- vim.api.nvim_set_hl(0, "DiagnosticUnnecessary", {})

View File

@ -10,10 +10,17 @@ return {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets", "rafamadriz/friendly-snippets",
-- "zbirenbaum/copilot.lua",
-- "zbirenbaum/copilot-cmp",
}, },
config = function() config = function()
local cmp = require("cmp") local cmp = require("cmp")
local luasnip = require("luasnip") local luasnip = require("luasnip")
-- require("copilot").setup({
-- suggestion = { enabled = false },
-- panel = { enabled = false },
-- })
-- require("copilot-cmp")
require("luasnip/loaders/from_vscode").lazy_load() require("luasnip/loaders/from_vscode").lazy_load()
@ -43,7 +50,13 @@ return {
Event = "", Event = "",
Operator = "", Operator = "",
TypeParameter = "", 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({ cmp.setup({
snippet = { snippet = {

View File

@ -9,7 +9,7 @@ return {
"folke/neodev.nvim", "folke/neodev.nvim",
"RRethy/vim-illuminate", "RRethy/vim-illuminate",
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
"simrat39/rust-tools.nvim", -- "simrat39/rust-tools.nvim",
}, },
config = function() config = function()
-- Set up Mason before anything else -- Set up Mason before anything else
@ -18,6 +18,7 @@ return {
ensure_installed = { ensure_installed = {
"lua_ls", "lua_ls",
"pylsp", "pylsp",
"rust_analyzer",
}, },
automatic_installation = true, automatic_installation = true,
}) })
@ -143,20 +144,25 @@ return {
}, },
}, },
}) })
local rt = require("rust-tools") -- Rust
rt.setup({ require("lspconfig")["rust_analyzer"].setup({
server = { on_attach = on_attach,
on_attach= function(_, bufnr) capabilities = capabilities,
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,
},
}
}) })
-- 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, end,
}, },
} }

View File

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