Open-Source Wikis

/

TypeScript

/

Features

/

Language-service features

microsoft/TypeScript

Language-service features

The user-facing IDE capabilities the language service provides. This page is the per-feature index; for the architecture of the service itself see systems/language-service, and for refactors and code-fixes specifically see features/refactors-and-codefixes.

Feature catalogue

Feature File Notes
Completions src/services/completions.ts (6,173 lines) Symbol-based, keyword, JSX-attribute, string-literal, paths, JSDoc-tag completions; auto-import support
String completions src/services/stringCompletions.ts Specifically string-literal contexts: imports, process.env, etc.
Hover (quickInfo) src/services/services.tssymbolDisplay.ts Type + JSDoc panel
Signature help src/services/signatureHelp.ts Per-parameter info while typing a call
Go to definition src/services/goToDefinition.ts Definition / type-definition / implementation
Find all references src/services/findAllReferences.ts (2,803 lines) Powers find-references and rename
Rename services/rename.ts + reuses findAllReferences Single-symbol cross-file rename
Document highlights src/services/documentHighlights.ts Same-file occurrence highlighting
Inlay hints src/services/inlayHints.ts Inferred-type / parameter-name hints
Outlining (folding) src/services/outliningElementsCollector.ts Foldable regions
Smart selection src/services/smartSelection.ts "Expand selection"
Navigate to src/services/navigateTo.ts Fuzzy symbol search
Navigation bar src/services/navigationBar.ts Top-of-document outline
Call hierarchy src/services/callHierarchy.ts Incoming/outgoing calls
Breakpoints src/services/breakpoints.ts Validate/compute breakable spans
Classifier src/services/classifier.ts + classifier2020.ts Syntactic + semantic colourisation
Suggestion diagnostics src/services/suggestionDiagnostics.ts "Did you mean async?", unused-symbol style suggestions
Format src/services/formatting/ On-type, range, document formatting
Map code src/services/mapCode.ts Suggest-diff-style mapping for AI assistants
Paste edits src/services/pasteEdits.ts Update imports when pasting code from another file
Rename file src/services/getEditsForFileRename.ts Update import paths when a file is renamed
Organize imports src/services/organizeImports.ts Sort + remove unused imports
Code fixes src/services/codefixes/ See features/refactors-and-codefixes
Refactors src/services/refactors/ See features/refactors-and-codefixes
Transpile src/services/transpile.ts transpileModule / transpileDeclaration (used by tools like Babel and Vite)

Cross-feature primitives

Several files are heavily reused:

Feature lifecycle

sequenceDiagram
    participant Editor
    participant tsserver as src/server/session.ts
    participant Service as createLanguageService
    participant Provider as e.g. completions.ts
    participant Checker as checker.ts

    Editor->>tsserver: { command: "completionInfo", ... }
    tsserver->>Service: getCompletionsAtPosition(file, pos, options)
    Service->>Provider: getCompletionsAtPosition
    Provider->>Service: program.getTypeChecker
    Service->>Checker: getSymbolsInScope, getTypeAtLocation
    Checker-->>Provider: types/symbols
    Provider->>Service: CompletionInfo
    Service->>tsserver: CompletionInfo (translated to protocol shape)
    tsserver->>Editor: response message

Tests

Almost all language-service features are tested with fourslash. The pattern:

/// <reference path="fourslash.ts" />

////import { /*1*/ } from "./util";

verify.completions({ marker: '1', includes: ['foo', 'bar'] });

tests/cases/fourslash/ contains roughly 3,500 of these. See how-to-contribute/testing.

Entry points for modification

See systems/language-service for the surrounding architecture.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Language-service features – TypeScript wiki | Factory