Skip to content

TypeScript Tsgo Extra

lang.typescript-tsgo is the TypeScript and JavaScript stack that registers the experimental tsgo language server instead of ts_ls.

Enable this extra instead of lang.typescript, not alongside it. If lang.typescript is enabled in the extras state file, disable it with :BlakExtras disable lang.typescript.

Enable it

-- ~/.config/blak/lua/blak/user.lua
return {
extras = {
enabled = {
"lang.typescript-tsgo",
},
},
}

Or toggle it interactively:

:BlakExtras enable lang.typescript-tsgo
:BlakExtras disable lang.typescript

What it adds

SurfaceContribution
Treesitterjavascript, typescript, tsx, jsdoc, json
Masonprettier, prettierd, eslint_d
LSPtsgo, eslint
Formattingprettierd, falling back to prettier, for JS/TS/JSON filetypes
Lintingeslint_d for JS/TS filetypes
Apply hookRemoves ts_ls from the merged config before future setup

The extra registers the tsgo LSP name. It does not add a Mason package for the server itself, so use :LspInfo and :BlakDoctor to confirm your local setup can start it.

Configure tsgo

Put tsgo settings under lsp.servers.tsgo:

return {
extras = {
enabled = { "lang.typescript-tsgo" },
},
lsp = {
servers = {
tsgo = {
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = "all",
},
},
},
},
eslint = {
settings = {
workingDirectory = { mode = "auto" },
},
},
},
},
}

Configure formatting and linting

This extra uses the same formatter and linter defaults as lang.typescript. Override the filetype entries before the extra fills them:

return {
extras = {
enabled = { "lang.typescript-tsgo" },
},
format = {
formatters_by_ft = {
typescript = { "prettier" },
typescriptreact = { "prettier" },
},
},
lint = {
linters_by_ft = {
typescript = { "eslint_d" },
typescriptreact = { "eslint_d" },
},
},
}

Switching from ts_ls

When switching from lang.typescript, restart Neovim after disabling it. The extra removes ts_ls from future setup, but an LSP client that already attached in the current session will keep running until it is stopped or Neovim exits.

Install and verify

:BlakToolsInstall
:BlakTreesitterInstall
:BlakDoctor

Then open a TypeScript file and check :LspInfo for tsgo.