From bdbc65aadc708ce528efb22bca5f82a7cca6b54d Mon Sep 17 00:00:00 2001 From: Yi Ming Date: Thu, 5 Sep 2024 16:26:31 +0800 Subject: [PATCH] feat(ts_ls)!: rename `tsserver` to `ts_ls` #3232 `tsserver` cannot be used as an abbreviation for `typescript-language-server`, because there is [`tsserver`](https://github.com/microsoft/TypeScript/wiki/Standalone-Server-(tsserver)) already and it is completely different from `typescript-language-server`. This is misleading. As the [README of `typescript-language-server`](https://github.com/typescript-language-server/typescript-language-server/blob/master/README.md) says, it's a wrapper of `tsserver`. This abuse has been around for so many time in lspconfig that people don't realize they are two different things, and are then confused by replacements of `typescript-language-server` like [typescript-tools.nvim](https://github.com/pmizio/typescript-tools.nvim) and [vtsls](https://github.com/yioneko/vtsls). --- doc/server_configurations.md | 84 ++++++++++--------- doc/server_configurations.txt | 84 ++++++++++--------- lua/lspconfig.lua | 4 + .../server_configurations/svelte.lua | 2 +- .../{tsserver.lua => ts_ls.lua} | 4 +- lua/lspconfig/server_configurations/volar.lua | 4 +- 6 files changed, 96 insertions(+), 86 deletions(-) rename lua/lspconfig/server_configurations/{tsserver.lua => ts_ls.lua} (91%) diff --git a/doc/server_configurations.md b/doc/server_configurations.md index a75c0e00f7..7207858bf8 100644 --- a/doc/server_configurations.md +++ b/doc/server_configurations.md @@ -297,8 +297,8 @@ autogenerated from the Lua files. You can view this file in Nvim by running - [thriftls](#thriftls) - [tilt_ls](#tilt_ls) - [tinymist](#tinymist) +- [ts_ls](#ts_ls) - [tsp_server](#tsp_server) -- [tsserver](#tsserver) - [ttags](#ttags) - [turtle_ls](#turtle_ls) - [tvm_ffi_navigator](#tvm_ffi_navigator) @@ -11691,7 +11691,7 @@ require'lspconfig'.superhtml.setup{} https://github.com/sveltejs/language-tools/tree/master/packages/language-server -Note: assuming that [tsserver](#tsserver) is setup, full JavaScript/TypeScript support (find references, rename, etc of symbols in Svelte files when working in JS/TS files) requires per-project installation and configuration of [typescript-svelte-plugin](https://github.com/sveltejs/language-tools/tree/master/packages/typescript-plugin#usage). +Note: assuming that [ts_ls](#ts_ls) is setup, full JavaScript/TypeScript support (find references, rename, etc of symbols in Svelte files when working in JS/TS files) requires per-project installation and configuration of [typescript-svelte-plugin](https://github.com/sveltejs/language-tools/tree/master/packages/typescript-plugin#usage). `svelte-language-server` can be installed via `npm`: ```sh @@ -12527,44 +12527,12 @@ require'lspconfig'.tinymist.setup{} ``` -## tsp_server - -https://github.com/microsoft/typespec - -The language server for TypeSpec, a language for defining cloud service APIs and shapes. - -`tsp-server` can be installed together with the typespec compiler via `npm`: -```sh -npm install -g @typespec/compiler -``` - - - -**Snippet to enable the language server:** -```lua -require'lspconfig'.tsp_server.setup{} -``` - - -**Default values:** - - `cmd` : - ```lua - { "tsp-server", "--stdio" } - ``` - - `filetypes` : - ```lua - { "typespec" } - ``` - - `root_dir` : - ```lua - util.root_pattern("tspconfig.yaml", ".git") - ``` - - -## tsserver +## ts_ls https://github.com/typescript-language-server/typescript-language-server +`ts_ls`, aka `typescript-language-server`, is a Language Server Protocol implementation for TypeScript wrapping `tsserver`. Note that `ts_ls` is not `tsserver`. + `typescript-language-server` depends on `typescript`. Both packages can be installed via `npm`: ```sh npm install -g typescript typescript-language-server @@ -12598,7 +12566,7 @@ adds Vue support to this language server. *IMPORTANT*: It is crucial to ensure that `@vue/typescript-plugin` and `volar `are of identical versions. ```lua -require'lspconfig'.tsserver.setup{ +require'lspconfig'.ts_ls.setup{ init_options = { plugins = { { @@ -12631,7 +12599,7 @@ require'lspconfig'.tsserver.setup{ **Snippet to enable the language server:** ```lua -require'lspconfig'.tsserver.setup{} +require'lspconfig'.ts_ls.setup{} ``` @@ -12660,6 +12628,40 @@ require'lspconfig'.tsserver.setup{} ``` +## tsp_server + +https://github.com/microsoft/typespec + +The language server for TypeSpec, a language for defining cloud service APIs and shapes. + +`tsp-server` can be installed together with the typespec compiler via `npm`: +```sh +npm install -g @typespec/compiler +``` + + + +**Snippet to enable the language server:** +```lua +require'lspconfig'.tsp_server.setup{} +``` + + +**Default values:** + - `cmd` : + ```lua + { "tsp-server", "--stdio" } + ``` + - `filetypes` : + ```lua + { "typespec" } + ``` + - `root_dir` : + ```lua + util.root_pattern("tspconfig.yaml", ".git") + ``` + + ## ttags https://github.com/npezza93/ttags @@ -13538,8 +13540,8 @@ Volar by default supports Vue 3 projects. Vue 2 projects need [additional configuration](https://github.com/vuejs/language-tools/tree/master/packages/vscode-vue#usage). **TypeScript support** -As of release 2.0.0, Volar no longer wraps around tsserver. For typescript -support, `tsserver` needs to be configured with the `@vue/typescript-plugin` +As of release 2.0.0, Volar no longer wraps around ts_ls. For typescript +support, `ts_ls` needs to be configured with the `@vue/typescript-plugin` plugin. **Take Over Mode** diff --git a/doc/server_configurations.txt b/doc/server_configurations.txt index a75c0e00f7..7207858bf8 100644 --- a/doc/server_configurations.txt +++ b/doc/server_configurations.txt @@ -297,8 +297,8 @@ autogenerated from the Lua files. You can view this file in Nvim by running - [thriftls](#thriftls) - [tilt_ls](#tilt_ls) - [tinymist](#tinymist) +- [ts_ls](#ts_ls) - [tsp_server](#tsp_server) -- [tsserver](#tsserver) - [ttags](#ttags) - [turtle_ls](#turtle_ls) - [tvm_ffi_navigator](#tvm_ffi_navigator) @@ -11691,7 +11691,7 @@ require'lspconfig'.superhtml.setup{} https://github.com/sveltejs/language-tools/tree/master/packages/language-server -Note: assuming that [tsserver](#tsserver) is setup, full JavaScript/TypeScript support (find references, rename, etc of symbols in Svelte files when working in JS/TS files) requires per-project installation and configuration of [typescript-svelte-plugin](https://github.com/sveltejs/language-tools/tree/master/packages/typescript-plugin#usage). +Note: assuming that [ts_ls](#ts_ls) is setup, full JavaScript/TypeScript support (find references, rename, etc of symbols in Svelte files when working in JS/TS files) requires per-project installation and configuration of [typescript-svelte-plugin](https://github.com/sveltejs/language-tools/tree/master/packages/typescript-plugin#usage). `svelte-language-server` can be installed via `npm`: ```sh @@ -12527,44 +12527,12 @@ require'lspconfig'.tinymist.setup{} ``` -## tsp_server - -https://github.com/microsoft/typespec - -The language server for TypeSpec, a language for defining cloud service APIs and shapes. - -`tsp-server` can be installed together with the typespec compiler via `npm`: -```sh -npm install -g @typespec/compiler -``` - - - -**Snippet to enable the language server:** -```lua -require'lspconfig'.tsp_server.setup{} -``` - - -**Default values:** - - `cmd` : - ```lua - { "tsp-server", "--stdio" } - ``` - - `filetypes` : - ```lua - { "typespec" } - ``` - - `root_dir` : - ```lua - util.root_pattern("tspconfig.yaml", ".git") - ``` - - -## tsserver +## ts_ls https://github.com/typescript-language-server/typescript-language-server +`ts_ls`, aka `typescript-language-server`, is a Language Server Protocol implementation for TypeScript wrapping `tsserver`. Note that `ts_ls` is not `tsserver`. + `typescript-language-server` depends on `typescript`. Both packages can be installed via `npm`: ```sh npm install -g typescript typescript-language-server @@ -12598,7 +12566,7 @@ adds Vue support to this language server. *IMPORTANT*: It is crucial to ensure that `@vue/typescript-plugin` and `volar `are of identical versions. ```lua -require'lspconfig'.tsserver.setup{ +require'lspconfig'.ts_ls.setup{ init_options = { plugins = { { @@ -12631,7 +12599,7 @@ require'lspconfig'.tsserver.setup{ **Snippet to enable the language server:** ```lua -require'lspconfig'.tsserver.setup{} +require'lspconfig'.ts_ls.setup{} ``` @@ -12660,6 +12628,40 @@ require'lspconfig'.tsserver.setup{} ``` +## tsp_server + +https://github.com/microsoft/typespec + +The language server for TypeSpec, a language for defining cloud service APIs and shapes. + +`tsp-server` can be installed together with the typespec compiler via `npm`: +```sh +npm install -g @typespec/compiler +``` + + + +**Snippet to enable the language server:** +```lua +require'lspconfig'.tsp_server.setup{} +``` + + +**Default values:** + - `cmd` : + ```lua + { "tsp-server", "--stdio" } + ``` + - `filetypes` : + ```lua + { "typespec" } + ``` + - `root_dir` : + ```lua + util.root_pattern("tspconfig.yaml", ".git") + ``` + + ## ttags https://github.com/npezza93/ttags @@ -13538,8 +13540,8 @@ Volar by default supports Vue 3 projects. Vue 2 projects need [additional configuration](https://github.com/vuejs/language-tools/tree/master/packages/vscode-vue#usage). **TypeScript support** -As of release 2.0.0, Volar no longer wraps around tsserver. For typescript -support, `tsserver` needs to be configured with the `@vue/typescript-plugin` +As of release 2.0.0, Volar no longer wraps around ts_ls. For typescript +support, `ts_ls` needs to be configured with the `@vue/typescript-plugin` plugin. **Take Over Mode** diff --git a/lua/lspconfig.lua b/lua/lspconfig.lua index 0823ec8d28..b9012f8780 100644 --- a/lua/lspconfig.lua +++ b/lua/lspconfig.lua @@ -27,6 +27,10 @@ local function server_alias(name) to = 'lua_ls', version = '0.2.0', }, + tsserver = { + to = 'ts_ls', + version = '0.2.0', + }, } return aliases[name] diff --git a/lua/lspconfig/server_configurations/svelte.lua b/lua/lspconfig/server_configurations/svelte.lua index a08bb954dd..edaa740d34 100644 --- a/lua/lspconfig/server_configurations/svelte.lua +++ b/lua/lspconfig/server_configurations/svelte.lua @@ -10,7 +10,7 @@ return { description = [[ https://github.com/sveltejs/language-tools/tree/master/packages/language-server -Note: assuming that [tsserver](#tsserver) is setup, full JavaScript/TypeScript support (find references, rename, etc of symbols in Svelte files when working in JS/TS files) requires per-project installation and configuration of [typescript-svelte-plugin](https://github.com/sveltejs/language-tools/tree/master/packages/typescript-plugin#usage). +Note: assuming that [ts_ls](#ts_ls) is setup, full JavaScript/TypeScript support (find references, rename, etc of symbols in Svelte files when working in JS/TS files) requires per-project installation and configuration of [typescript-svelte-plugin](https://github.com/sveltejs/language-tools/tree/master/packages/typescript-plugin#usage). `svelte-language-server` can be installed via `npm`: ```sh diff --git a/lua/lspconfig/server_configurations/tsserver.lua b/lua/lspconfig/server_configurations/ts_ls.lua similarity index 91% rename from lua/lspconfig/server_configurations/tsserver.lua rename to lua/lspconfig/server_configurations/ts_ls.lua index 6220e7f2f5..38a7c80042 100644 --- a/lua/lspconfig/server_configurations/tsserver.lua +++ b/lua/lspconfig/server_configurations/ts_ls.lua @@ -19,6 +19,8 @@ return { description = [[ https://github.com/typescript-language-server/typescript-language-server +`ts_ls`, aka `typescript-language-server`, is a Language Server Protocol implementation for TypeScript wrapping `tsserver`. Note that `ts_ls` is not `tsserver`. + `typescript-language-server` depends on `typescript`. Both packages can be installed via `npm`: ```sh npm install -g typescript typescript-language-server @@ -52,7 +54,7 @@ adds Vue support to this language server. *IMPORTANT*: It is crucial to ensure that `@vue/typescript-plugin` and `volar `are of identical versions. ```lua -require'lspconfig'.tsserver.setup{ +require'lspconfig'.ts_ls.setup{ init_options = { plugins = { { diff --git a/lua/lspconfig/server_configurations/volar.lua b/lua/lspconfig/server_configurations/volar.lua index 4875b1ffa1..888cd1651d 100644 --- a/lua/lspconfig/server_configurations/volar.lua +++ b/lua/lspconfig/server_configurations/volar.lua @@ -44,8 +44,8 @@ Volar by default supports Vue 3 projects. Vue 2 projects need [additional configuration](https://github.com/vuejs/language-tools/tree/master/packages/vscode-vue#usage). **TypeScript support** -As of release 2.0.0, Volar no longer wraps around tsserver. For typescript -support, `tsserver` needs to be configured with the `@vue/typescript-plugin` +As of release 2.0.0, Volar no longer wraps around ts_ls. For typescript +support, `ts_ls` needs to be configured with the `@vue/typescript-plugin` plugin. **Take Over Mode**