feat: inlay hints for ts and more LSPs

This commit is contained in:
2026-02-23 14:40:01 +01:00
parent 2bba7045ef
commit fdea1f7270
4 changed files with 51 additions and 4 deletions

View File

@@ -15,6 +15,15 @@ vim.filetype.add({extension = {svx = "markdown"}})
vim.cmd('syntax enable')
vim.cmd('filetype plugin indent on')
require("config.lazy")
require("config.lazy")
--vim.cmd[[colorscheme tokyonight]]
vim.api.nvim_create_user_command(
"Inlay",
function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end,
{desc = 'Toggles Inlay Hints'}
)

View File

@@ -0,0 +1,29 @@
return {
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
javascript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
}
}

View File

@@ -1,3 +1,4 @@
return {
{
@@ -18,7 +19,12 @@ return {
{
"williamboman/mason-lspconfig.nvim",
opts = {
ensure_installed = { "clangd" },
ensure_installed = {
"svelte",
"clangd",
"ts_ls",
"pyright"
},
},
dependencies = {
{ "mason-org/mason.nvim", opts = {} },
@@ -34,6 +40,7 @@ return {
{ name = 'path' },
}
},
event = "InsertEnter",
dependencies = {
{'L3MON4D3/LuaSnip'},
{'hrsh7th/cmp-buffer'},
@@ -47,13 +54,14 @@ return {
-- Define your formatters
formatters_by_ft = {
cpp = { "clang-format" },
python = {"black"}
},
-- Set default options
default_format_opts = {
lsp_format = "fallback",
},
-- Set up format-on-save
format_on_save = { timeout_ms = 500 },
format_on_save = { timeout_ms = 1000 },
-- Customize formatters
formatters = {
['clang-format'] = {
@@ -65,3 +73,4 @@ return {
},
}
}

View File

@@ -11,7 +11,7 @@ return{
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = { "c", "cpp", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html" },
ensure_installed = { "c", "cpp","haskell", "lua","svelte","python", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html" },
sync_install = false,
highlight = { enable = true },
indent = { enable = true },