@@ -7,6 +7,17 @@ You can enable the extra with the `:LazyExtras` command.
77Plugins marked as optional will only be configured if they are installed.
88:::
99
10+ ### Options
11+
12+ Additional options for this extra can be configured in your [ lua/config/options.lua] ( /configuration/general#options ) file:
13+
14+ ``` lua title="lua/config/options.lua"
15+ -- LSP Server to use for TypeScript.
16+ vim .g .lazyvim_ts_lsp = " vtsls" -- currently the default
17+ -- Set to "tsgo" to use the new typescript-language-server implementation instead of tsserver.
18+ vim .g .lazyvim_ts_lsp = " tsgo"
19+ ```
20+
1021Below you can find a list of included plugins and their default settings.
1122
1223::: caution
@@ -30,13 +41,50 @@ import TabItem from '@theme/TabItem';
3041opts = {
3142 -- make sure mason installs the server
3243 servers = {
33- --- @deprecated -- tsserver renamed to ts_ls but not yet released, so keep this for now
34- --- the proper approach is to check the nvim-lspconfig release version when it's released to determine the server name dynamically
35- tsserver = {
36- enabled = false ,
37- },
38- ts_ls = {
39- enabled = false ,
44+ --- @type lspconfig.settings.tsgo
45+ tsgo = {
46+ -- explicitly add default filetypes, so that we can extend
47+ -- them in related extras
48+ filetypes = {
49+ " javascript" ,
50+ " javascriptreact" ,
51+ " javascript.jsx" ,
52+ " typescript" ,
53+ " typescriptreact" ,
54+ " typescript.tsx" ,
55+ },
56+ settings = {
57+ typescript = {
58+ inlayHints = {
59+ parameterNames = {
60+ enabled = " literals" ,
61+ suppressWhenArgumentMatchesName = true ,
62+ },
63+ parameterTypes = { enabled = true },
64+ variableTypes = { enabled = true },
65+ propertyDeclarationTypes = { enabled = true },
66+ functionLikeReturnTypes = { enabled = true },
67+ enumMemberValues = { enabled = true },
68+ },
69+ },
70+ },
71+ keys = {
72+ {
73+ " <leader>co" ,
74+ LazyVim .lsp .action [" source.organizeImports" ],
75+ desc = " Organize Imports" ,
76+ },
77+ {
78+ " <leader>cu" ,
79+ LazyVim .lsp .action [" source.removeUnused.ts" ],
80+ desc = " Remove unused imports" ,
81+ },
82+ {
83+ " <leader>cD" ,
84+ LazyVim .lsp .action [" source.fixAll.ts" ],
85+ desc = " Fix all diagnostics" ,
86+ },
87+ },
4088 },
4189 vtsls = {
4290 -- explicitly add default filetypes, so that we can extend
@@ -216,13 +264,50 @@ opts = {
216264 opts = {
217265 -- make sure mason installs the server
218266 servers = {
219- --- @deprecated -- tsserver renamed to ts_ls but not yet released, so keep this for now
220- --- the proper approach is to check the nvim-lspconfig release version when it's released to determine the server name dynamically
221- tsserver = {
222- enabled = false ,
223- },
224- ts_ls = {
225- enabled = false ,
267+ --- @type lspconfig.settings.tsgo
268+ tsgo = {
269+ -- explicitly add default filetypes, so that we can extend
270+ -- them in related extras
271+ filetypes = {
272+ " javascript" ,
273+ " javascriptreact" ,
274+ " javascript.jsx" ,
275+ " typescript" ,
276+ " typescriptreact" ,
277+ " typescript.tsx" ,
278+ },
279+ settings = {
280+ typescript = {
281+ inlayHints = {
282+ parameterNames = {
283+ enabled = " literals" ,
284+ suppressWhenArgumentMatchesName = true ,
285+ },
286+ parameterTypes = { enabled = true },
287+ variableTypes = { enabled = true },
288+ propertyDeclarationTypes = { enabled = true },
289+ functionLikeReturnTypes = { enabled = true },
290+ enumMemberValues = { enabled = true },
291+ },
292+ },
293+ },
294+ keys = {
295+ {
296+ " <leader>co" ,
297+ LazyVim .lsp .action [" source.organizeImports" ],
298+ desc = " Organize Imports" ,
299+ },
300+ {
301+ " <leader>cu" ,
302+ LazyVim .lsp .action [" source.removeUnused.ts" ],
303+ desc = " Remove unused imports" ,
304+ },
305+ {
306+ " <leader>cD" ,
307+ LazyVim .lsp .action [" source.fixAll.ts" ],
308+ desc = " Fix all diagnostics" ,
309+ },
310+ },
226311 },
227312 vtsls = {
228313 -- explicitly add default filetypes, so that we can extend
@@ -396,6 +481,44 @@ opts = {
396481
397482</Tabs >
398483
484+ ## [ nvim-lspconfig] ( https://github.com/neovim/nvim-lspconfig )
485+
486+ <Tabs >
487+
488+ <TabItem value =" opts " label =" Options " >
489+
490+ ``` lua
491+ opts = function (_ , opts )
492+ local servers = { " tsserver" , " ts_ls" , " vtsls" , " tsgo" , lsp }
493+ for _ , server in ipairs (servers ) do
494+ opts .servers [server ] = opts .servers [server ] or {}
495+ opts .servers [server ].enabled = server == lsp
496+ end
497+ end
498+ ```
499+
500+ </TabItem >
501+
502+
503+ <TabItem value =" code " label =" Full Spec " >
504+
505+ ``` lua
506+ {
507+ " neovim/nvim-lspconfig" ,
508+ opts = function (_ , opts )
509+ local servers = { " tsserver" , " ts_ls" , " vtsls" , " tsgo" , lsp }
510+ for _ , server in ipairs (servers ) do
511+ opts .servers [server ] = opts .servers [server ] or {}
512+ opts .servers [server ].enabled = server == lsp
513+ end
514+ end ,
515+ }
516+ ```
517+
518+ </TabItem >
519+
520+ </Tabs >
521+
399522## [ mason.nvim] ( https://github.com/mason-org/mason.nvim )
400523
401524<Tabs >
0 commit comments