mirror of
https://git.aramjonghu.dev/AramJonghu/nvim.git
synced 2026-09-01 15:43:29 +02:00
feat(type hinting config): added configuration defaults for langs
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
vim.lsp.config("vtsls", {
|
||||
settings = {
|
||||
typescript = {
|
||||
inlayHints = {
|
||||
parameterNames = { enabled = "all" },
|
||||
parameterTypes = { enabled = true },
|
||||
variableTypes = { enabled = true },
|
||||
propertyDeclarationTypes = { enabled = true },
|
||||
functionLikeReturnTypes = { enabled = true },
|
||||
enumMemberValues = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("denols", {
|
||||
settings = {
|
||||
deno = {
|
||||
inlayHints = {
|
||||
parameterNames = {
|
||||
enabled = "all", -- "none" | "literals" | "all"
|
||||
suppressWhenArgumentMatchesName = true,
|
||||
},
|
||||
parameterTypes = { enabled = true },
|
||||
variableTypes = {
|
||||
enabled = true,
|
||||
suppressWhenTypeMatchesName = true,
|
||||
},
|
||||
propertyDeclarationTypes = { enabled = true },
|
||||
functionLikeReturnTypes = { enabled = true },
|
||||
enumMemberValues = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("basedpyright", {
|
||||
settings = {
|
||||
basedpyright = {
|
||||
analysis = {
|
||||
inlayHints = {
|
||||
variableTypes = true, -- Variable type hints
|
||||
callArgumentNames = true, -- Function argument name hints
|
||||
callArgumentNamesMatching = false, -- Show even when arg name matches param name
|
||||
functionReturnTypes = true, -- Function return type hints
|
||||
genericTypes = true, -- Inferred generic type hints
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("gopls", {
|
||||
settings = {
|
||||
gopls = {
|
||||
hints = {
|
||||
assignVariableTypes = true, -- Variable type hints in assignments
|
||||
compositeLiteralFields = true, -- Composite literal field name hints
|
||||
compositeLiteralTypes = true, -- Composite literal type hints
|
||||
constantValues = true, -- Constant value hints (iota)
|
||||
functionTypeParameters = true, -- Generic function type parameter hints
|
||||
ignoredError = true, -- Implicitly discarded error hints (experimental)
|
||||
parameterNames = true, -- Function call parameter name hints
|
||||
rangeVariableTypes = true, -- Range statement variable type hints
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("rust_analyzer", {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
inlayHints = {
|
||||
-- Type related
|
||||
typeHints = { enable = true }, -- Variable type hints
|
||||
chainingHints = { enable = true }, -- Method chain type hints
|
||||
closureReturnTypeHints = { enable = "never" }, -- "never" | "always"
|
||||
closureCaptureHints = { enable = false }, -- Closure capture hints
|
||||
-- Parameter related
|
||||
parameterHints = { enable = true }, -- Function parameter hints
|
||||
-- Brace related
|
||||
closingBraceHints = { enable = true, minLines = 25 }, -- Closing brace hints
|
||||
-- Other
|
||||
bindingModeHints = { enable = false }, -- Binding mode hints
|
||||
discriminantHints = { enable = "never" }, -- Enum discriminant hints
|
||||
expressionAdjustmentHints = { enable = "never" }, -- Type adjustment hints
|
||||
implicitDrops = { enable = false }, -- Implicit drop hints
|
||||
lifetimeElisionHints = { enable = "never" }, -- Lifetime elision hints
|
||||
genericParameterHints = {
|
||||
type = { enable = false },
|
||||
lifetime = { enable = false },
|
||||
const = { enable = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("zls", {
|
||||
settings = {
|
||||
zls = {
|
||||
enable_inlay_hints = true, -- Global enable
|
||||
inlay_hints_show_builtin = true, -- Show builtin function hints
|
||||
inlay_hints_show_parameter_name = true, -- Show parameter name hints
|
||||
inlay_hints_show_variable_type_hints = true, -- Show variable type hints
|
||||
inlay_hints_show_struct_literal_field_type = true, -- Show struct literal field type hints
|
||||
inlay_hints_exclude_single_argument = true, -- Exclude single argument hints
|
||||
inlay_hints_hide_redundant_param_names = false, -- Hide redundant parameter names
|
||||
inlay_hints_hide_redundant_param_names_last_token = false, -- Hide redundant param names for last token
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("jdtls", {
|
||||
settings = {
|
||||
java = {
|
||||
inlayHints = {
|
||||
parameterNames = {
|
||||
enabled = "all", -- "none" | "literals" | "all"
|
||||
exclusions = { "this" },
|
||||
},
|
||||
variableTypes = { enabled = true }, -- Variable type hints
|
||||
parameterTypes = { enabled = true }, -- Parameter type hints
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config("phpactor", {
|
||||
settings = {
|
||||
language_server_worse_reflection = {
|
||||
inlay_hints = {
|
||||
enable = true, -- Master switch
|
||||
types = true, -- Variable type hints
|
||||
params = true, -- Parameter name hints
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -1,10 +1,11 @@
|
||||
local cmp_cap = require("config.cmp").capabilities
|
||||
|
||||
local servers = {
|
||||
"gopls",
|
||||
"phpactor",
|
||||
"ols",
|
||||
"zls",
|
||||
"ts_ls",
|
||||
"vtsls",
|
||||
"eslint",
|
||||
"yamlls",
|
||||
"vimls",
|
||||
|
||||
@@ -2,7 +2,7 @@ return {
|
||||
{
|
||||
"MysticalDevil/inlay-hints.nvim",
|
||||
event = "LspAttach",
|
||||
dependencies = { "neovim/nvim-lspconfig" }, -- optional
|
||||
dependencies = { "neovim/nvim-lspconfig" },
|
||||
config = function() require("inlay-hints").setup() end,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user