diff --git a/nvim/.config/nvim/after/ftplugin/rust.vim b/nvim/.config/nvim/after/ftplugin/rust.vim index 5db7e6e..2d347a3 100644 --- a/nvim/.config/nvim/after/ftplugin/rust.vim +++ b/nvim/.config/nvim/after/ftplugin/rust.vim @@ -1,18 +1,6 @@ compiler cargo setlocal makeprg=cargo\ build\ --all -nnoremap rD :RustDisableInlayHints -nnoremap rt :RustToggleInlayHints -nnoremap rr :RustRunnables -nnoremap rm :RustExpandMacro -nnoremap rc :RustOpenCargo -nnoremap rp :RustParentModule -nnoremap rj :RustJoinLines -nnoremap rh :RustHoverActions -nnoremap rd :RustMoveItemDown -nnoremap ru :RustMoveItemUp -nnoremap rs :RustStartStandaloneServerForBuffer - nnoremap cbb :Dispatch! cargo build nnoremap cbc :Dispatch! cargo clean nnoremap cbd :Dispatch! cargo doc diff --git a/nvim/.config/nvim/lua/lsp.lua b/nvim/.config/nvim/lua/lsp.lua index 1f3d355..fe6052b 100644 --- a/nvim/.config/nvim/lua/lsp.lua +++ b/nvim/.config/nvim/lua/lsp.lua @@ -2,6 +2,14 @@ local nvim_lsp = require 'lspconfig' local protocol = require 'vim.lsp.protocol' local util = require 'lspconfig/util' local lightbulb = require 'nvim-lightbulb' +local inlay_hint = require 'lsp-inlayhints' + +-- Set up inlay hints +inlay_hint.setup({ + inlay_hints = { + highlight = "Hint" + } +}) -- https://github.com/neovim/nvim-lspconfig/wiki/User-contributed-tips function FormatRangeOperator() @@ -147,6 +155,8 @@ local on_attach = function(client, bufnr) }) end end + + inlay_hint.on_attach(bufnr, client) end local on_init = function(client) @@ -162,40 +172,6 @@ capabilities.textDocument.completion.completionItem.resolveSupport = { properties = { 'documentation', 'detail', 'additionalTextEdits', } } -local rust_tool_opts = { - tools = { - autoSetHints = true, - hover_with_actions = false, - runnables = { use_telescope = false }, - debuggables = { use_telescope = false }, - inlay_hints = { - only_current_line = false, - only_current_line_autocmd = "CursorHold", - show_parameter_hints = true, - parameter_hints_prefix = "<- ", - other_hints_prefix = "=> ", - highlight = "Hint", - }, - hover_actions = { - auto_focus = true - }, - }, - server = { - on_init = on_init, - on_attach = on_attach, - capabilities = capabilities, - settings = { - ["rust-analyzer"] = { - checkOnSave = { - command = "clippy" - }, - } - } - }, -} - -require('rust-tools').setup(rust_tool_opts) - local servers = { clangd = { default_config = { @@ -227,7 +203,44 @@ local servers = { }, }, }, - tsserver = {}, + rust_analyzer = { + settings = { + ["rust-analyzer"] = { + procMacro = { + enable = true + }, + checkOnSave = { + command = "clippy" + }, + } + } + }, + tsserver = { + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = 'all', + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + } + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = 'all', + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + } + } + } + }, } for client, config in pairs(servers) do diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 1d4f24a..2aec0e8 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -69,7 +69,7 @@ local init = function () } -- Language support & syntax highlighting use 'mfussenegger/nvim-lint' - use 'simrat39/rust-tools.nvim' + use 'lvimuser/lsp-inlayhints.nvim' -- treesitter based syntax highlighting use { 'nvim-treesitter/nvim-treesitter',