Skip to content

feat: add typescript_tsgo language backend (TypeScript 7 native LSP)#1406

Open
8SFXIM5 wants to merge 3 commits intooraios:mainfrom
8SFXIM5:feat/typescript-tsgo-support
Open

feat: add typescript_tsgo language backend (TypeScript 7 native LSP)#1406
8SFXIM5 wants to merge 3 commits intooraios:mainfrom
8SFXIM5:feat/typescript-tsgo-support

Conversation

@8SFXIM5
Copy link
Copy Markdown

@8SFXIM5 8SFXIM5 commented Apr 24, 2026

Summary

Adds typescript_tsgo as a new experimental TypeScript language backend, using tsgo — the native Go-based TypeScript 7 compiler with built-in LSP support.

Closes #1402

Motivation

  • No Node.js dependency: tsgo implements the LSP protocol natively in Go, eliminating the need for typescript-language-server + tsserver.js wrapper
  • Faster startup: Go binary starts significantly faster than the Node.js-based stack
  • Standard LSP: Unlike tsserver's custom protocol, tsgo speaks native LSP via tsgo --lsp --stdio
  • Future-proof: TypeScript 7.0 is the direction the TypeScript team is heading

Changes

  • New file: src/solidlsp/language_servers/tsgo_language_server.py
    • Uses LanguageServerDependencyProviderSinglePath pattern (recommended approach)
    • Supports ls_path custom setting for user-specified binary path
    • Reuses prefer_non_node_modules_definition from the existing TypeScript backend
  • Modified: src/solidlsp/ls_config.py
    • Added TYPESCRIPT_TSGO enum member (marked as experimental)
    • Registered in get_source_fn_matcher() and get_ls_class()
  • New file: test/solidlsp/typescript/test_typescript_tsgo.py
    • Tests for symbol discovery, cross-file references, and clean symbol names
    • Reuses the existing TypeScript test repo via _LANGUAGE_REPO_ALIASES
    • Skipped when tsgo is not installed
  • Updated: test/conftest.py, pyproject.toml (markers), CHANGELOG.md, docs

Usage

# project.yml
languages: [typescript_tsgo]

Or with custom binary path:

languages: [typescript_tsgo]
ls_specific_settings:
  typescript_tsgo:
    ls_path: /path/to/tsgo

Testing

Tested locally with tsgo 7.0.0-dev.20260421.2 on Ubuntu 22.04. All three core LSP features verified:

  • documentSymbol (symbol discovery)
  • textDocument/definition (go-to-definition)
  • textDocument/references (find references)

Note: CI will skip tsgo tests automatically since tsgo is not yet available as a standard CI dependency. A GitHub Actions step for installing @typescript/native-preview could be added in a follow-up.

Copy link
Copy Markdown
Contributor

@MischaPanch MischaPanch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a shallow review, will re-review again once these comments are addressed and tests for tsgo run through in CI

pytestmark = pytest.mark.typescript_tsgo


@pytest.mark.skipif(not _tsgo_servers, reason="tsgo not installed or tests disabled")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no need for the new test, instead tsgo should be added to the list of languages in the existing typescript tests. The adding can be conditional, but it always should be added in CI, so pls use the in_ci function which we already provide in conftest.

You should modify the pytest workflow to make sure tsgo is available

import shutil

tsgo_path = shutil.which("tsgo")
if tsgo_path is None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be installed on the fly, like other dependencies that are managed by npm. Pls check how other language servers do that and repeat the pattern here

* **TypeScript**
* **Vue**
(by default, uses [typescript-language-server](https://github.com/typescript-language-server/typescript-language-server) (language `typescript`);
we also support [tsgo](https://github.com/nicolo-ribaudo/tc39-proposal-type-annotations) (language `typescript_tsgo`), the native Go-based TypeScript 7 compiler with built-in LSP — does not require Node.js, must be installed separately via `npm install -g @typescript/native-preview`)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls adjust accordingly after addressing the other comments

extern.shiji.yan added 3 commits April 28, 2026 10:57
Add support for tsgo as an alternative TypeScript language backend.
tsgo is the native Go-based TypeScript 7 compiler with built-in LSP,
which does not require Node.js.

Closes oraios#1402
…into existing suite

- Replace shutil.which() lookup with npm-based auto-install pattern
  (using RuntimeDependencyCollection like typescript_language_server)
- Remove standalone test_typescript_tsgo.py; parametrize existing
  typescript tests with TYPESCRIPT_TSGO (always in CI via is_ci)
- Add tsgo installation step to pytest CI workflow
- Update docs to reflect automatic installation
@8SFXIM5 8SFXIM5 force-pushed the feat/typescript-tsgo-support branch from aff66d9 to a2eb8af Compare April 28, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Support TypeScript 7 native LSP (tsgo) as a language backend

2 participants