From 9b8793b18b787ec9e30f163f209a8938c219e98e Mon Sep 17 00:00:00 2001 From: An Hoang Date: Sun, 4 Jun 2023 15:10:06 +0700 Subject: fix(astro): update astro config for new version of astro (#2647) `@astrojs/language-server@2.0.0` utilizes Volar language server under the hood. The LSP's init_options are located [here][1]. `typescript.serverPath` has been renamed to `typescript.tsdk`. There is no `configuration`; that option is for the VSCode extension, located in the `astro-vscode` package [here][2]. [1]: https://github.com/volarjs/volar.js/blob/dfc8ccefb6c3aa53bd0eb9755259538a11127edd/packages/language-server/src/types.ts#L50 [2]: https://github.com/withastro/language-tools/blob/eb2ce0b3effd00e49294be57ef0f3d1cb5f8f454/packages/vscode/package.json#L126 --- lua/lspconfig/server_configurations/astro.lua | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'lua') diff --git a/lua/lspconfig/server_configurations/astro.lua b/lua/lspconfig/server_configurations/astro.lua index 40d60a6b..6a70c680 100644 --- a/lua/lspconfig/server_configurations/astro.lua +++ b/lua/lspconfig/server_configurations/astro.lua @@ -12,18 +12,11 @@ return { filetypes = { 'astro' }, root_dir = util.root_pattern('package.json', 'tsconfig.json', 'jsconfig.json', '.git'), init_options = { - typescript = { - serverPath = '', - }, - configuration = {}, + typescript = {}, }, on_new_config = function(new_config, new_root_dir) - if - new_config.init_options - and new_config.init_options.typescript - and new_config.init_options.typescript.serverPath == '' - then - new_config.init_options.typescript.serverPath = get_typescript_server_path(new_root_dir) + if vim.tbl_get(new_config.init_options, 'typescript') and not new_config.init_options.typescript.tsdk then + new_config.init_options.typescript.tsdk = get_typescript_server_path(new_root_dir) end end, }, -- cgit v1.3.1