[docs] how to use typescript-go lsp #34

Closed
opened 2026-02-16 17:24:55 -05:00 by yindo · 11 comments
Owner

Originally created by @sockthedev on GitHub (Jun 6, 2025).

Originally assigned to: @thdxr on GitHub.

https://github.com/microsoft/typescript-go

its finally giving me a great experience in neovim. feels mega responsive, and features like find usage etc are working.

probably worth considering testing it here and documenting the option to use it.

below is how i configure it for neovim.

install the latest build;

npm install -g @typescript/native-preview

and then manually extend the lsp config;

local configs = require 'lspconfig.configs'

if not configs.tsgo then
  configs.tsgo = {
    default_config = {
      cmd = { 'tsgo', '--lsp', '--stdio' },
      filetypes = {
        'javascript',
        'javascriptreact',
        'javascript.jsx',
        'typescript',
        'typescriptreact',
        'typescript.tsx',
      },
      root_dir = require('lspconfig').util.root_pattern(
        'tsconfig.json',
        'pnpm-lock.yaml',
        'package-lock.json',
        'yarn.lock',
        'bun.lockb',
        '.git'
      ),
    },
  }
end

you can register it in the same way you register other lsps.

make sure to disable/remove any other typescript lsp you might have had configured.

Originally created by @sockthedev on GitHub (Jun 6, 2025). Originally assigned to: @thdxr on GitHub. https://github.com/microsoft/typescript-go its finally giving me a great experience in neovim. feels mega responsive, and features like find usage etc are working. probably worth considering testing it here and documenting the option to use it. below is how i configure it for neovim. install the latest build; ``` npm install -g @typescript/native-preview ``` and then manually extend the lsp config; ```lua local configs = require 'lspconfig.configs' if not configs.tsgo then configs.tsgo = { default_config = { cmd = { 'tsgo', '--lsp', '--stdio' }, filetypes = { 'javascript', 'javascriptreact', 'javascript.jsx', 'typescript', 'typescriptreact', 'typescript.tsx', }, root_dir = require('lspconfig').util.root_pattern( 'tsconfig.json', 'pnpm-lock.yaml', 'package-lock.json', 'yarn.lock', 'bun.lockb', '.git' ), }, } end ``` you can register it in the same way you register other lsps. make sure to disable/remove any other typescript lsp you might have had configured.
yindo closed this issue 2026-02-16 17:24:55 -05:00
Author
Owner
@sockthedev commented on GitHub (Jun 11, 2025): key recent merges on typescript-go repo: https://github.com/microsoft/typescript-go/pull/1105 https://github.com/microsoft/typescript-go/pull/1078 https://github.com/microsoft/typescript-go/pull/1074
Author
Owner

@sockthedev commented on GitHub (Jun 12, 2025):

note: i haven't tested this yet on opencode, as waiting on overhaul release. working great for me in neovim, so suspect opencode support wouldn't be long around the corner if any issues. consider this a note for those interested in testing it though


for anyone interested in using the typescript-go lsp.

npm install -g @typescript/native-preview

and then add the following to your opencode config:

{
  "lsp": {
    "typescript": {
      "disabled": false,
      "command": "tsgo",
      "args": ["--lsp", "--stdio"]
    }
  }
}
@sockthedev commented on GitHub (Jun 12, 2025): **note:** i haven't tested this yet on opencode, as waiting on overhaul release. working great for me in neovim, so suspect opencode support wouldn't be long around the corner if any issues. consider this a note for those interested in testing it though --- for anyone interested in using the typescript-go lsp. ```bash npm install -g @typescript/native-preview ``` and then add the following to your opencode config: ```json { "lsp": { "typescript": { "disabled": false, "command": "tsgo", "args": ["--lsp", "--stdio"] } } } ```
Author
Owner

@thdxr commented on GitHub (Jun 12, 2025):

this works for you? trying it on the new version of opencode and it hangs waiting for diagnostics

@thdxr commented on GitHub (Jun 12, 2025): this works for you? trying it on the new version of opencode and it hangs waiting for diagnostics
Author
Owner

@sockthedev commented on GitHub (Jun 13, 2025):

oh, i haven't tried opencode yet. waiting on the release. but in neovim its working great for me. i suspect it won't be long until its stable enough in opencode too. they feel really close to an overall stable experience. so much faster than the js version.

updated my comment to reflect this.

this is more a recommendation for docs and/or interested parties

@sockthedev commented on GitHub (Jun 13, 2025): oh, i haven't tried opencode yet. waiting on the release. but in neovim its working great for me. i suspect it won't be long until its stable enough in opencode too. they feel really close to an overall stable experience. so much faster than the js version. updated my comment to reflect this. this is more a recommendation for docs and/or interested parties
Author
Owner

@sockthedev commented on GitHub (Jun 13, 2025):

this works for you? trying it on the new version of opencode and it hangs waiting for diagnostics

wondering if there is an unbounded root context. as most of the tsgo lsp issues have revolved around over eager or underoptimised file watchers architecture.

@sockthedev commented on GitHub (Jun 13, 2025): > this works for you? trying it on the new version of opencode and it hangs waiting for diagnostics wondering if there is an unbounded root context. as most of the tsgo lsp issues have revolved around over eager or underoptimised file watchers architecture.
Author
Owner

@sockthedev commented on GitHub (Jun 13, 2025):

also, happy to test this on my mac if there is a way to install the overhaul branch.

@sockthedev commented on GitHub (Jun 13, 2025): also, happy to test this on my mac if there is a way to install the overhaul branch.
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Author
Owner

@rubnogueira commented on GitHub (Jan 8, 2026):

note: i haven't tested this yet on opencode, as waiting on overhaul release. working great for me in neovim, so suspect opencode support wouldn't be long around the corner if any issues. consider this a note for those interested in testing it though

for anyone interested in using the typescript-go lsp.

npm install -g @typescript/native-preview
and then add the following to your opencode config:

{
"lsp": {
"typescript": {
"disabled": false,
"command": "tsgo",
"args": ["--lsp", "--stdio"]
}
}
}

I tried this approach, and it didn't work. opencode refuses to open. I've been using typescript-go with VSCode/Cursor and the performance is outstanding (autocomplete, linting, etc), so I think lsp is in a good state.

I see that opencode uses oxlint, so I wonder if it's possible to leverage their tsgo integration with lsp.

https://oxc.rs/docs/guide/usage/linter/type-aware.html#type-checking-diagnostics

Based on this post --type-check lints and type-checks at the same time, so maybe it's possible to use the oxlint for typescript as lsp, potentially saving RAM usage?

https://oxc.rs/blog/2025-12-08-type-aware-alpha.html#support-for-type-checking-while-linting

@rubnogueira commented on GitHub (Jan 8, 2026): > **note:** i haven't tested this yet on opencode, as waiting on overhaul release. working great for me in neovim, so suspect opencode support wouldn't be long around the corner if any issues. consider this a note for those interested in testing it though > > for anyone interested in using the typescript-go lsp. > > npm install -g @typescript/native-preview > and then add the following to your opencode config: > > { > "lsp": { > "typescript": { > "disabled": false, > "command": "tsgo", > "args": ["--lsp", "--stdio"] > } > } > } I tried this approach, and it didn't work. opencode refuses to open. I've been using typescript-go with VSCode/Cursor and the performance is outstanding (autocomplete, linting, etc), so I think lsp is in a good state. I see that opencode uses oxlint, so I wonder if it's possible to leverage their tsgo integration with lsp. https://oxc.rs/docs/guide/usage/linter/type-aware.html#type-checking-diagnostics Based on this post --type-check lints and type-checks at the same time, so maybe it's possible to use the oxlint for typescript as lsp, potentially saving RAM usage? https://oxc.rs/blog/2025-12-08-type-aware-alpha.html#support-for-type-checking-while-linting
Author
Owner

@rubnogueira commented on GitHub (Feb 6, 2026):

I added native support for tsgo with this PR: https://github.com/anomalyco/opencode/pull/12492

cc @thdxr @rekram1-node

@rubnogueira commented on GitHub (Feb 6, 2026): I added native support for tsgo with this PR: https://github.com/anomalyco/opencode/pull/12492 cc @thdxr @rekram1-node
Author
Owner

@Destreyf commented on GitHub (Feb 6, 2026):

@rubnogueira I did the config approach with great success, however I didn't call it "typescript" like they did, and I used npx to run the tsgo binary. I don't have that config on hand, but it was something along these lines:

{
  "$schema": "https://opencode.ai/config.json",
  "lsp": {
    "typescript": {
      "disabled": true
    },
    "tsgo": {
      "command": ["npx", "-y", "@typescript/native-preview@latest", "--lsp", "--stdio"],
      "extensions": [".cjs", ".mjs", ".js", ".jsx", ".ts", ".tsx", ".mts"]
    }
  }
}

This fixed a bunch of issues I was having in my monorepo with the default typescript lsp in opencode where it didn't seem to respect my per project tsconfig files.

Additionally you should probably open a new issue and link that instead as this is currently marked as closed.

@Destreyf commented on GitHub (Feb 6, 2026): @rubnogueira I did the config approach with great success, however I didn't call it "typescript" like they did, and I used `npx` to run the tsgo binary. I don't have that config on hand, but it was something along these lines: ```json { "$schema": "https://opencode.ai/config.json", "lsp": { "typescript": { "disabled": true }, "tsgo": { "command": ["npx", "-y", "@typescript/native-preview@latest", "--lsp", "--stdio"], "extensions": [".cjs", ".mjs", ".js", ".jsx", ".ts", ".tsx", ".mts"] } } } ``` This fixed a bunch of issues I was having in my monorepo with the default typescript lsp in opencode where it didn't seem to respect my per project tsconfig files. Additionally you should probably open a new issue and link that instead as this is currently marked as closed.
Author
Owner

@rubnogueira commented on GitHub (Feb 6, 2026):

@Destreyf #12522 :)

Thank you for your suggestion. Your solution is very similar to my PR implementation, but it detects if tsgo is available. Hopefully it is easy to review.

@rubnogueira commented on GitHub (Feb 6, 2026): @Destreyf #12522 :) Thank you for your suggestion. Your solution is very similar to my PR implementation, but it detects if tsgo is available. Hopefully it is easy to review.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#34