Added inlayhints to tssevrer config
Added remap to toggle inlay hints
This commit is contained in:
@@ -44,7 +44,14 @@ return {
|
|||||||
settings = {
|
settings = {
|
||||||
cmd = { cmd, "--stdio" },
|
cmd = { cmd, "--stdio" },
|
||||||
tsserver_file_preferences = {
|
tsserver_file_preferences = {
|
||||||
includeCompletionsForModuleExports = true,
|
includeInlayParameterNameHints = "all",
|
||||||
|
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
|
||||||
|
includeInlayFunctionParameterTypeHints = true,
|
||||||
|
includeInlayVariableTypeHints = true,
|
||||||
|
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
|
||||||
|
includeInlayPropertyDeclarationTypeHints = true,
|
||||||
|
includeInlayFunctionLikeReturnTypeHints = true,
|
||||||
|
includeInlayEnumMemberValueHints = true,
|
||||||
quotePreference = "auto",
|
quotePreference = "auto",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,6 +27,17 @@ local on_attach = function(client, bufnr)
|
|||||||
vim.keymap.set("n", "<leader>vrn", function()
|
vim.keymap.set("n", "<leader>vrn", function()
|
||||||
vim.lsp.buf.rename()
|
vim.lsp.buf.rename()
|
||||||
end, opts("Rename symbol"))
|
end, opts("Rename symbol"))
|
||||||
|
vim.keymap.set("n", "<leader>vih", function()
|
||||||
|
if vim.fn.has("nvim-0.10.0") == 0 then
|
||||||
|
vim.notify("Inlay hints are only available in Neovim 0.10.0 and above", vim.log.levels.ERROR)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if client.server_capabilities.inlayHintProvider then
|
||||||
|
local current_state = vim.lsp.inlay_hint.is_enabled(bufnr)
|
||||||
|
vim.lsp.inlay_hint.enable(bufnr, not current_state)
|
||||||
|
end
|
||||||
|
end, opts("Toggle inlay hints"))
|
||||||
vim.keymap.set("n", "[d", function()
|
vim.keymap.set("n", "[d", function()
|
||||||
vim.diagnostic.goto_next()
|
vim.diagnostic.goto_next()
|
||||||
end, opts("Go to next diagnostic"))
|
end, opts("Go to next diagnostic"))
|
||||||
|
|||||||
Reference in New Issue
Block a user