feat(extras): configure nvim-vtsls

This commit is contained in:
Feliche-Demian Netliukh 2024-03-31 10:29:30 +01:00
parent 6f404064e0
commit 7349089511

View file

@ -14,57 +14,122 @@ return {
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
opts = function(_, opts) opts = function(_, opts)
vim.list_extend(opts.servers, { -- set default server config to use nvim-vtsls one, which would allow use to use the plugin
-- ---@type lspconfig.options.vtsls require("lspconfig.configs").vtsls = require("vtsls").lspconfig
vtsls = {
settings = { -- ---@type lspconfig.options.vtsls
vtsls = { opts.servers.vtsls = {
experimental = { -- you can view all keys here: https://github.com/yioneko/nvim-vtsls#commands
completion = { -- keys = {
enableServerSideFuzzyMatch = true, -- {
}, -- "<leader>cto",
-- function()
-- require("vtsls").commands.organize_imports(0)
-- end,
-- desc = "Organize Imports",
-- },
-- {
-- "<leader>ctm",
-- function()
-- require("vtsls").commands.add_missing_imports(0)
-- end,
-- desc = "Add missing imports",
-- },
-- {
-- "<leader>ctd",
-- function()
-- require("vtsls").commands.fix_all(0)
-- end,
-- desc = "Fix all diagnostics",
-- },
-- {
-- "<leader>ctl",
-- function()
-- require("vtsls").commands.open_tsserver_log()
-- end,
-- desc = "Open Log",
-- },
-- {
-- "<leader>ctR",
-- function()
-- require("vtsls").commands.rename_file(0)
-- end,
-- desc = "Rename File",
-- },
-- {
-- "<leader>ctr",
-- function()
-- require("vtsls").commands.file_references(0)
-- end,
-- desc = "Show Rile References",
-- },
-- {
-- "<leader>ctc",
-- function()
-- require("vtsls").commands.goto_project_config(0)
-- end,
-- desc = "Open project config",
-- },
-- },
settings = {
vtsls = {
experimental = {
completion = {
enableServerSideFuzzyMatch = true,
}, },
}, },
javascript = { },
format = { javascript = {
indentSize = vim.o.shiftwidth, format = {
convertTabsToSpaces = vim.o.expandtab, indentSize = vim.o.shiftwidth,
tabSize = vim.o.tabstop, convertTabsToSpaces = vim.o.expandtab,
}, tabSize = vim.o.tabstop,
-- otherwise it would ask every time if you want to update imports, which is a bit annoying
updateImportsOnFileMove = {
enabled = "always",
},
}, },
typescript = { -- enables inline hints
format = { inlayHints = {
indentSize = vim.o.shiftwidth, parameterNames = { enabled = "literals" },
convertTabsToSpaces = vim.o.expandtab, parameterTypes = { enabled = true },
tabSize = vim.o.tabstop, variableTypes = { enabled = true },
}, propertyDeclarationTypes = { enabled = true },
inlayHints = { functionLikeReturnTypes = { enabled = true },
parameterNames = { enabled = "literals" }, enumMemberValues = { enabled = true },
parameterTypes = { enabled = true }, },
variableTypes = { enabled = true }, -- otherwise it would ask every time if you want to update imports, which is a bit annoying
propertyDeclarationTypes = { enabled = true }, updateImportsOnFileMove = {
functionLikeReturnTypes = { enabled = true }, enabled = "always",
enumMemberValues = { enabled = true }, },
}, -- cool feature, but increases ram usage
updateImportsOnFileMove = { -- referencesCodeLens = {
enabled = "always", -- enabled = true,
}, -- showOnAllFunctions = true,
-- cool feature, but increases ram usage a lot -- },
-- referencesCodeLens = { },
-- enabled = true, typescript = {
-- showOnAllFunctions = true, format = {
-- }, indentSize = vim.o.shiftwidth,
convertTabsToSpaces = vim.o.expandtab,
tabSize = vim.o.tabstop,
},
updateImportsOnFileMove = {
enabled = "always",
},
inlayHints = {
parameterNames = { enabled = "literals" },
parameterTypes = { enabled = true },
variableTypes = { enabled = true },
propertyDeclarationTypes = { enabled = true },
functionLikeReturnTypes = { enabled = true },
enumMemberValues = { enabled = true },
}, },
}, },
}, },
}) }
end, end,
dependencies = { dependencies = {
"yioneko/nvim-vtsls", {
"yioneko/nvim-vtsls",
handlers = {},
},
}, },
}, },
{ {