TypeScript plugin factory that integrates Angular Language Service with TypeScript Language Server (tsserver) to provide Angular template support in IDEs.
Main factory function that creates the Angular Language Service plugin for TypeScript server integration.
/**
* TypeScript server plugin factory for Angular Language Service integration
* This is the main export that tsserver uses to instantiate the Angular plugin
*/
declare const factory: ts.server.PluginModuleFactory;Usage in tsconfig.json:
{
"compilerOptions": {
"plugins": [
{
"name": "@angular/language-service",
"angularOnly": true,
"forceStrictTemplates": true,
"enableBlockSyntax": false,
"suppressAngularDiagnosticCodes": [2345, 2322]
}
]
}
}Internal interface that defines the plugin module structure for TypeScript server integration.
interface PluginModule extends ts.server.PluginModule {
/**
* Creates an Angular Language Service instance
* @param createInfo - TypeScript plugin creation info
* @returns NgLanguageService instance
*/
create(createInfo: ts.server.PluginCreateInfo): NgLanguageService;
/**
* Gets external files that should be included in the project
* @param project - TypeScript server project
* @param updateLevel - Program update level (Full, RootNamesAndUpdate, Update)
* @returns Array of external file paths
*/
getExternalFiles?(project: ts.server.Project, updateLevel: ts.ProgramUpdateLevel): string[];
/**
* Handles configuration changes for the plugin
* @param config - Updated plugin configuration
*/
onConfigurationChanged?(config: PluginConfig): void;
}The factory function that creates and configures the plugin module.
/**
* Creates a TypeScript server plugin module for Angular Language Service
* @param tsModule - TypeScript module instance
* @returns Plugin module with create and configuration methods
*/
export declare const factory: (tsModule: typeof ts) => PluginModule;Plugin Lifecycle:
create methodcreate method instantiates the Angular Language ServiceonConfigurationChanged if providedSeparate plugin factory that disables TypeScript's built-in rename provider when Angular is detected, allowing Angular's rename functionality to take precedence.
/**
* Plugin factory that overrides TypeScript's rename functionality in Angular projects
* Used to ensure Angular-specific rename behavior takes precedence
*/
declare const factory: ts.server.PluginModuleFactory;
/**
* Override plugin module interface
* Provides getRenameInfo that delegates to Angular when Angular core is detected
*/
interface OverridePluginModule extends ts.server.PluginModule {
create(info: ts.server.PluginCreateInfo): ts.LanguageService;
}Usage:
This plugin is typically configured automatically by IDE extensions or can be manually added to tsconfig.json:
{
"compilerOptions": {
"plugins": [
{
"name": "@angular/language-service/override_rename_ts_plugin"
}
]
}
}How it works:
@angular/core/core.d.ts or @angular/core/index.d.tsDirect access to the bundled Angular Language Service for advanced integrations.
/**
* Direct bundle export for advanced integrations
* Available at @angular/language-service/bundles/language-service.js
*/
declare const bundledLanguageService: (tsModule: typeof ts) => PluginModule;Usage:
// Advanced usage: Direct bundle import
const languageServiceBundle = require('@angular/language-service/bundles/language-service.js');
const plugin = languageServiceBundle(ts);The plugin integrates with popular IDEs through TypeScript Language Server:
Works with various Angular build setups:
Plugin configuration is resolved in this order: