microsoft / microsoft/TypeScript
Proposal: Expose LSP/Language Service capabilities (e.g., rename) via a tsc subcommand
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
🔍 Search Terms
lsp rename refactor
✅ Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
As AI coding agents evolve, structured program manipulation becomes increasingly vital. While tsc currently excels at type-checking and emitting JavaScript, programmatic refactoring (such as symbol renaming) is only exposed through the Language Service API in Node.js or via standard LSP integration over IPC.
To better support CLI-driven agent workflows, we should consider exposing core Language Service features through dedicated tsc subcommands (e.g., tsc rename ).
Prior Art / Motivation:
Other language toolchains already offer similar CLI interfaces for headless program transformation. For instance, Go provides native subcommand/tooling support via gopls (e.g., gopls rename ...), allowing external CLI tools and AI agents to execute deterministic, workspace-wide symbol renames without needing to boot a full LSP client or write custom Node.js wrappers around typescript.createLanguageService.
Exposing this in tsc would provide:
A standardized, zero-dependency CLI interface for AI agents to perform refactoring safely.
Deterministic AST/type-aware renaming out of the box for automated workflows.
Reduced friction for CLI tool developers who currently have to mock or bridge LSP protocols.
📃 Motivating Example
$ gopls rename --help
rename selected identifier
Usage:
gopls [flags] rename [rename-flags] <position> <name>
Example:
$ # 1-based location (:line:column or :#position) of the thing to change
$ gopls rename helper/helper.go:8:6 Foo
$ gopls rename helper/helper.go:#53 Foo
rename-flags:
-d,-diff
display diffs instead of edited file content
-l,-list
display names of edited files
-preserve
with -write, make copies of original files
-w,-write
write edited content to source files
💻 Use Cases
- agent vibe coding
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die vorhandene tsc-CLI-Oberfläche und die Language Service API zu überprüfen, wobei die beschriebene gopls-Rename-Schnittstelle als Referenz dient. Lege vor der Implementierung die Befehlsform, die unterstützten Fähigkeiten und das Verhalten bei der Ausgabe von workspace/edit fest; abgeschlossen wäre die Arbeit mit einem abgestimmten Umfang für einen deterministischen CLI-Refactoring-Workflow.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- cli, developer-experience
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Aktiv
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100