feat: add inlay hints
This commit is contained in:
parent
f3a0d0d35f
commit
b0664537c3
16 changed files with 661 additions and 641 deletions
|
|
@ -12,3 +12,4 @@ vim.cmd([[highlight BufferInactive guifg=#888888 guibg=#131a24]])
|
||||||
vim.cmd([[highlight BufferInactiveMod guifg=#dbc074 guibg=#131a24]])
|
vim.cmd([[highlight BufferInactiveMod guifg=#dbc074 guibg=#131a24]])
|
||||||
vim.cmd([[highlight BufferInactiveSign guifg=#719cd6 guibg=#131a24]])
|
vim.cmd([[highlight BufferInactiveSign guifg=#719cd6 guibg=#131a24]])
|
||||||
|
|
||||||
|
vim.cmd([[highlight LspInlayHint guibg=#192330]])
|
||||||
|
|
|
||||||
|
|
@ -40,4 +40,3 @@ end)
|
||||||
nvim_tree_events.subscribe("TreeClose", function()
|
nvim_tree_events.subscribe("TreeClose", function()
|
||||||
bufferline_api.set_offset(0)
|
bufferline_api.set_offset(0)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ keymap("n", "<F10>", ':lua require("dap").close()<CR> :lua require("dapui").togg
|
||||||
|
|
||||||
-- file tree
|
-- file tree
|
||||||
keymap("n", "t", ":ToggleTerm<CR>", opts)
|
keymap("n", "t", ":ToggleTerm<CR>", opts)
|
||||||
keymap("n", "n", ':lua require("nvim-tree").toggle()<CR>', opts)
|
keymap("n", "f", ':lua require("nvim-tree").toggle()<CR>', opts)
|
||||||
|
|
||||||
-- tab switching
|
-- tab switching
|
||||||
keymap("n", "<F1>", ":BufferPrev<CR>", opts)
|
keymap("n", "<F1>", ":BufferPrev<CR>", opts)
|
||||||
|
|
@ -44,4 +44,3 @@ require("trouble").setup({
|
||||||
open_tab = {},
|
open_tab = {},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ require("mason-lspconfig").setup({
|
||||||
"ansiblels", -- ansible
|
"ansiblels", -- ansible
|
||||||
"marksman", -- markdown
|
"marksman", -- markdown
|
||||||
"asm_lsp", -- assembly
|
"asm_lsp", -- assembly
|
||||||
|
"tsserver", -- js and ts
|
||||||
},
|
},
|
||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
})
|
})
|
||||||
|
|
@ -33,9 +34,13 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protoc
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
|
-- require("lsp-format").setup {}
|
||||||
|
require("lsp-inlayhints").setup()
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||||
local optslsp = { noremap = false, silent = true, buffer = bufnr }
|
local optslsp = { noremap = false, silent = true, buffer = bufnr }
|
||||||
|
-- require("lsp-format").on_attach(client)
|
||||||
|
require("lsp-inlayhints").on_attach(client, bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
require("mason-lspconfig").setup_handlers({
|
require("mason-lspconfig").setup_handlers({
|
||||||
|
|
@ -50,13 +55,41 @@ require("mason-lspconfig").setup_handlers({
|
||||||
|
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
['tsserver'] = function()
|
||||||
|
require('lspconfig').tsserver.setup {
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
require("lsp-format").setup {}
|
|
||||||
|
|
||||||
local on_attach = function(client)
|
|
||||||
require("lsp-format").on_attach(client)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- special server setups
|
-- special server setups
|
||||||
require("clangd_extensions").setup()
|
require("clangd_extensions").setup()
|
||||||
|
|
@ -67,13 +100,3 @@ require("rust-tools").setup({
|
||||||
loadOutputiDirs = false,
|
loadOutputiDirs = false,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
require("typescript").setup({
|
|
||||||
disable_commands = false, -- prevent the plugin from creating Vim commands
|
|
||||||
debug = false, -- enable debug logging for commands
|
|
||||||
go_to_source_definition = {
|
|
||||||
fallback = true, -- fall back to standard LSP definition on failure
|
|
||||||
},
|
|
||||||
server = { -- pass options to lspconfig's setup method
|
|
||||||
on_attach = on_attach,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,8 @@ Plug('akinsho/toggleterm.nvim',{ ["tag"] = "*" }) -- better
|
||||||
Plug("iamcco/markdown-preview.nvim", -- markdown preview
|
Plug("iamcco/markdown-preview.nvim", -- markdown preview
|
||||||
{ ["do"] = "cd app && yarn install" })
|
{ ["do"] = "cd app && yarn install" })
|
||||||
Plug('p00f/clangd_extensions.nvim') -- clangd_extensions
|
Plug('p00f/clangd_extensions.nvim') -- clangd_extensions
|
||||||
Plug('jose-elias-alvarez/typescript.nvim') -- typescript extensions
|
|
||||||
Plug('kdarkhan/rust-tools.nvim') -- rust extensions
|
Plug('kdarkhan/rust-tools.nvim') -- rust extensions
|
||||||
|
Plug('lvimuser/lsp-inlayhints.nvim') -- inlay hints
|
||||||
Plug('preservim/tagbar') -- tags on the right
|
Plug('preservim/tagbar') -- tags on the right
|
||||||
Plug('lukas-reineke/lsp-format.nvim')
|
|
||||||
vim.call("plug#end")
|
vim.call("plug#end")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
local t = require("telescope")
|
local t = require("telescope")
|
||||||
local z_utils = require("telescope._extensions.zoxide.utils")
|
local z_utils = require("telescope._extensions.zoxide.utils")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue