microsoft/TypeScript
User-facing surface area splits into four groups. (1) The tsc CLI: single-project and build-mode compilation, watch mode, incremental/tsbuildinfo, --init/--showConfig/--listFilesOnly, tracing, pprof, diagnostics statistics. (2) A broad LSP feature set: pull diagnostics, hover, completions with auto-imports, definitions/references/implementations, rename, formatting, code actions, code lenses, inlay hints, semantic tokens, call hierarchy, workspace symbols, folding/selection/linked-editing, willRenameFiles, plus custom debugging and content-mapper methods. (3) A ~300-method programmatic API over IPC (parse, transpile, symbol/type queries, diagnostics, emit). (4) The VS Code extension's commands and settings. Notably, CHANGES.md documents deliberate feature removals versus the Strada compiler (Closure-style JSDoc features, constructor expandos, several removed options).
- `tsc` batch mode resolves a tsconfig.json via -p/--project or an ancestor-directory search (findConfigFile), supports --watch, --init (WriteConfigFile), --version, --help/--all, --showConfig, and rejects incompatible flag combos like --watch with --listFilesOnly.
- `tsc -b/--build` build mode parses a build command line (tsoptions.ParseBuildCommandLine) and runs build.NewOrchestrator over the project-reference graph.
- Watch mode is created by createWatcher in internal/execute/watcher.go, layered on internal/execute/watchmanager and the vendored internal/fswatch backends.
- Incremental compilation reads a prior .tsbuildinfo via incremental.ReadBuildInfoProgram, then wraps the new program with incremental.NewProgram to compute changes and reuse results; emit bookkeeping lives in emitfileshandler.go/snapshottobuildinfo.go.
- Diagnostics options --diagnostics/--extendedDiagnostics report phase timings and memory statistics (statistics.go), --generateTrace writes a trace file via internal/tracing, and --pprofDir starts CPU/heap profiling via internal/pprof.
- The LSP server implements pull diagnostics (textDocument/diagnostic), hover, completion (+completionItem/resolve with auto-imports), definition/typeDefinition/sourceDefinition, references (incl. custom VS references), rename/prepareRename, workspace/willRenameFiles, formatting (document/range/on-type), codeAction, codeLens(+resolve), inlayHint, semanticTokens full/range, documentHighlight and a custom multiDocumentHighlight, foldingRange, selectionRange, linkedEditingRange, callHierarchy in/out, workspace/symbol, and VS autoInsert.
- Custom (non-standard) LSP methods are registered for logging ($/setLogVerbosity), developer profiling (runGC, saveHeapProfile, saveAllocProfile, startCPUProfile, stopCPUProfile), initializeAPISession, projectInfo, and setContentMapperContributions.
- Automatic type acquisition (ATA) lives in internal/project/ata: it discovers typings (discovertypings.go, typesmap.go), validates package names, and installs npm packages through an injected ata.NpmExecutor implemented by the LSP server via exec `npm`.
- Content mappers are a plugin mechanism: a tsconfig `contentMappers` entry names an npm package whose package.json declares Exec argv; the compiler spawns it as a child process speaking JSON-RPC (internal/ipc) to transform unsupported file types (e.g. .vue) into virtual TypeScript.
- The IPC API exposes ~300 methods declared in internal/api/proto.go, including createSnapshot/updateSnapshot, createSourceFile, transpileModule/transpileDeclaration, parseConfigFile, getSymbolAtPosition, getTypeAtLocation, getSignaturesOfType, getSemanticDiagnostics/getSyntacticDiagnostics/etc., emit/emitToString, getJavaScriptEmit/getDeclarationEmit, intrinsic-type getters, and profiling controls.
- The npm package exposes the API under unstable exports: ./unstable/sync and ./unstable/async clients, ./unstable/fs (FS callbacks into the Go server), ./unstable/proto, and an AST toolkit (./unstable/ast with is/factory/scanner/visitor/clone subpaths).
- The VS Code extension contributes commands typescript.native-preview.{enable,disable,restart,output.focus,reportIssue,selectVersion,goToSourceDefinition,sortImports,removeUnusedImports,codeLens.showLocations} plus dev.* profiling commands, and settings like js/ts.trace.server, js/ts.server.pprofDir, js/ts.server.goMemLimit, js/ts.contentMappers.enabled.
- A transpile-only path exists: internal/transpile provides transpileModule support and the API exposes transpileModule/transpileDeclaration methods; the hidden fmtMain path in execute can format a file using internal/format.
- tsc/CHANGES.md documents intentional behavior differences from the JS (Strada) compiler: trimmed JavaScript/JSDoc feature support (no Closure headers, no constructor expandos), removed options, and unified call-checking rules between .ts and .js.