fix(typescript): allow easier merging of ts plugins

This commit is contained in:
Folke Lemaitre 2024-05-30 11:17:08 +02:00
parent c4b7505969
commit cf6775a959
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 12 additions and 9 deletions

View file

@ -108,18 +108,21 @@ return {
-- disable tsserver -- disable tsserver
return true return true
end, end,
vtsls = function(_, opts)
-- copy typescript settings to javascript
opts.settings.javascript =
vim.tbl_deep_extend("force", {}, opts.settings.typescript, opts.settings.javascript or {})
local plugins = vim.tbl_get(opts.settings, "vtsls", "tsserver", "globalPlugins")
-- allow plugins to have a key for proper merging
-- remove the key here
if plugins then
opts.settings.vtsls.tsserver.globalPlugins = vim.tbl_values(plugins)
end
end,
}, },
}, },
}, },
{
"neovim/nvim-lspconfig",
opts = function(_, opts)
-- copy typescript settings to javascript
opts.servers.vtsls.settings.javascript = vim.deepcopy(opts.servers.vtsls.settings.typescript)
end,
},
{ {
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",
optional = true, optional = true,

View file

@ -32,7 +32,7 @@ return {
tsserver = { tsserver = {
globalPlugins = { globalPlugins = {
-- Use typescript language server along with vue typescript plugin -- Use typescript language server along with vue typescript plugin
{ vue = {
name = "@vue/typescript-plugin", name = "@vue/typescript-plugin",
location = vue_typescript_plugin, location = vue_typescript_plugin,
languages = { "vue" }, languages = { "vue" },