Update to use just nvim-lspconfig and lsp-inlayhints instead of rust-tools, since it's now unmaintained

This commit is contained in:
Nicole Tietz-Sokolskaya 2024-02-16 09:17:55 -05:00
parent bbb5df7ab2
commit ccd7321f98
4 changed files with 65 additions and 5 deletions

View File

@ -183,6 +183,7 @@ else
hi CursorIM guifg=#080808 guibg=#afff00 gui=NONE cterm=NONE hi CursorIM guifg=#080808 guibg=#afff00 gui=NONE cterm=NONE
hi ToolbarLine guifg=NONE guibg=#fdfdfd gui=NONE cterm=NONE hi ToolbarLine guifg=NONE guibg=#fdfdfd gui=NONE cterm=NONE
hi ToolbarButton guifg=#080808 guibg=#fdfdfd gui=bold cterm=bold hi ToolbarButton guifg=#080808 guibg=#fdfdfd gui=bold cterm=bold
hi LspInlayHint guifg=#A0A0A0 gui=italic cterm=italic
endif endif
if s:t_Co >= 256 if s:t_Co >= 256
@ -309,6 +310,7 @@ if s:t_Co >= 256
hi CursorIM ctermfg=232 ctermbg=154 cterm=NONE hi CursorIM ctermfg=232 ctermbg=154 cterm=NONE
hi ToolbarLine ctermfg=NONE ctermbg=188 cterm=NONE hi ToolbarLine ctermfg=NONE ctermbg=188 cterm=NONE
hi ToolbarButton ctermfg=232 ctermbg=188 cterm=bold hi ToolbarButton ctermfg=232 ctermbg=188 cterm=bold
hi LspInlayHint guifg=#A0A0A0 gui=italic cterm=italic
endif endif
unlet s:t_Co unlet s:t_Co
finish finish
@ -438,6 +440,7 @@ if s:t_Co >= 16
hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse
hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse
hi LspInlayHint guifg=#A0A0A0 gui=italic cterm=italic
endif endif
unlet s:t_Co unlet s:t_Co
finish finish
@ -567,6 +570,7 @@ if s:t_Co >= 8
hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse
hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse
hi LspInlayHint guifg=#A0A0A0 gui=italic cterm=italic
endif endif
unlet s:t_Co unlet s:t_Co
finish finish

View File

@ -6,8 +6,9 @@ source $HOME/.config/nvim/plugs.vim
source $HOME/.config/nvim/colors/quietly.vim source $HOME/.config/nvim/colors/quietly.vim
"source $HOME/.config/nvim/treesitter.lua "source $HOME/.config/nvim/treesitter.lua
source $HOME/.config/nvim/rust.lua "source $HOME/.config/nvim/rust.lua
source $HOME/.config/nvim/completion.lua source $HOME/.config/nvim/completion.lua
source $HOME/.config/nvim/lsp.lua
"syntax off "syntax off
filetype plugin indent on filetype plugin indent on

54
nvim/.config/nvim/lsp.lua Normal file
View File

@ -0,0 +1,54 @@
-- Setup language servers.
local lspconfig = require('lspconfig')
lspconfig.rust_analyzer.setup({})
-- Global mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
vim.keymap.set('n', '<Leader>e', vim.diagnostic.open_float)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<Leader>q', vim.diagnostic.setloclist)
-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('n', '<Leader>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<Leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<Leader>a', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<Leader>f', function()
vim.lsp.buf.format { async = true }
end, opts)
end,
})
local inlay = require('lsp-inlayhints')
inlay.setup {
enabled_at_startup = true,
}
-- Configure inlay hints any time the LSP supports them
vim.api.nvim_create_augroup("LspAttach_inlayhints", {})
vim.api.nvim_create_autocmd("LspAttach", {
group = "LspAttach_inlayhints",
callback = function(args)
if not (args.data and args.data.client_id) then
return
end
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
require("lsp-inlayhints").on_attach(client, bufnr)
end,
})

View File

@ -16,8 +16,8 @@ Plug 'tpope/vim-obsession'
Plug 'tpope/vim-fugitive' " whose fault is it Plug 'tpope/vim-fugitive' " whose fault is it
" Language support " Language support
Plug 'nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate' } "Plug 'nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate' }
Plug 'rust-lang/rust.vim' "Plug 'rust-lang/rust.vim'
" Plug 'ntietz/tla.vim' " Plug 'ntietz/tla.vim'
" Plug 'fatih/vim-go' " Plug 'fatih/vim-go'
" Plug 'pest-parser/pest.vim' " Plug 'pest-parser/pest.vim'
@ -39,14 +39,15 @@ Plug 'L3MON4D3/LuaSnip', {'tag': 'v1.*'}
Plug 'simrat39/rust-tools.nvim' Plug 'simrat39/rust-tools.nvim'
Plug 'neovim/nvim-lspconfig' Plug 'neovim/nvim-lspconfig'
Plug 'lvimuser/lsp-inlayhints.nvim', { 'branch': 'main' }
Plug 'nvim-lua/plenary.nvim' Plug 'nvim-lua/plenary.nvim'
" Nice hovers " Nice hovers
Plug 'stevearc/dressing.nvim' Plug 'stevearc/dressing.nvim'
" Our new AI overlords 🤖 " Our new AI overlords 🤖
Plug 'github/copilot.vim', { 'branch': 'release' } "Plug 'github/copilot.vim', { 'branch': 'release' }
" Uncomment this line to disable copilot " Uncomment this line to disable copilot
let g:copilot_enabled = 0 "let g:copilot_enabled = 0
call plug#end() call plug#end()