ts_ls: add comments for vue integration and adhere to code style

This commit is contained in:
Mia 2025-12-26 01:19:59 +01:00
commit a792378b46

View file

@ -65,10 +65,7 @@
end end
''; '';
}; };
on_attach = on_attach = mkLuaInline ''
mkLuaInline
# lua
''
function(client, bufnr) function(client, bufnr)
-- ts_ls provides `source.*` code actions that apply to the whole file. These only appear in -- ts_ls provides `source.*` code actions that apply to the whole file. These only appear in
-- `vim.lsp.buf.code_action()` if specified in `context.only`. -- `vim.lsp.buf.code_action()` if specified in `context.only`.
@ -84,6 +81,7 @@
}) })
end, {}) end, {})
-- make sure that vue-language-server handles semantic tokens when we are in a vue file
if vim.bo.filetype == 'vue' then if vim.bo.filetype == 'vue' then
client.server_capabilities.semanticTokensProvider.full = false client.server_capabilities.semanticTokensProvider.full = false
else else
@ -113,10 +111,8 @@
"package.json" "package.json"
".git" ".git"
]; ];
on_init = on_init = mkLuaInline ''
mkLuaInline -- forward typescript blocks to ts_ls or vtsls depending on which is available first
# lua
''
function(client) function(client)
client.handlers['tsserver/request'] = function(_, result, context) client.handlers['tsserver/request'] = function(_, result, context)
local ts_clients = vim.lsp.get_clients({ bufnr = context.bufnr, name = 'ts_ls' }) local ts_clients = vim.lsp.get_clients({ bufnr = context.bufnr, name = 'ts_ls' })