or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

configuration.mdindex.mdlanguage-service-api.mdtesting-framework.mdtypescript-plugin.md
tile.json

configuration.mddocs/

Configuration

Configuration options for customizing Angular Language Service behavior, integrating with different Angular versions, and controlling diagnostic reporting.

Capabilities

Plugin Configuration Interface

Main configuration interface for Angular Language Service plugin settings.

/**
 * Configuration options for Angular Language Service plugin
 * Used in tsconfig.json plugins section or IDE settings
 */
interface PluginConfig {
  /**
   * If true, return only Angular results. Otherwise, return Angular + TypeScript results.
   * When enabled, TypeScript-only features are disabled in templates.
   */
  angularOnly: boolean;
  
  /**
   * If true, enable `strictTemplates` in Angular compiler options regardless
   * of its value in tsconfig.json. Forces strict template type checking.
   */
  forceStrictTemplates?: true;
  
  /**
   * If false, disables parsing control flow blocks (@if, @for, @switch) in the compiler.
   * Should be used only when older versions of Angular that don't support blocks (pre-v17) 
   * are used with the language service.
   */
  enableBlockSyntax?: false;
  
  /**
   * Version of @angular/core that was detected in the user's workspace.
   * Used to enable/disable version-specific features and optimizations.
   */
  angularCoreVersion?: string;
  
  /**
   * If false, disables parsing of @let declarations in templates.
   * Used for Angular versions that don't support @let syntax.
   */
  enableLetSyntax?: false;
  
  /**
   * Whether selectorless components are enabled.
   * Allows components without CSS selectors in newer Angular versions.
   */
  enableSelectorless?: true;
  
  /**
   * List of Angular diagnostic codes that should be suppressed in the language service.
   * Useful for disabling specific Angular template errors or warnings.
   */
  suppressAngularDiagnosticCodes?: number[];
}

Configuration Examples

Basic tsconfig.json Configuration

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "@angular/language-service",
        "angularOnly": true,
        "forceStrictTemplates": true
      }
    ]
  }
}

Advanced Configuration

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "@angular/language-service",
        "angularOnly": false,
        "forceStrictTemplates": true,
        "enableBlockSyntax": true,
        "enableLetSyntax": true,
        "enableSelectorless": true,
        "angularCoreVersion": "17.2.0",
        "suppressAngularDiagnosticCodes": [2345, 2322, 8030]
      }
    ]
  }
}

Legacy Angular Support

For Angular versions before v17 (no control flow blocks):

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "@angular/language-service",
        "angularOnly": true,
        "enableBlockSyntax": false,
        "enableLetSyntax": false,
        "angularCoreVersion": "16.2.0"
      }
    ]
  }
}

Configuration Options Details

Angular-Only Mode

angularOnly: boolean

  • true: Shows only Angular-specific completions, diagnostics, and features in templates
  • false: Shows both Angular and TypeScript features (useful for mixed content)

Example Impact:

<!-- With angularOnly: true -->
<div>{{ user.| }}</div> <!-- Only Angular pipe completions -->

<!-- With angularOnly: false -->
<div>{{ user.| }}</div> <!-- Angular pipes + TypeScript string methods -->

Strict Templates

forceStrictTemplates?: true

Overrides Angular compiler's strictTemplates setting to enforce strict type checking in templates regardless of angular.json or tsconfig.json settings.

Effects:

  • Strict type checking for template expressions
  • Better type inference for template variables
  • More detailed error reporting
  • Enhanced autocomplete accuracy

Control Flow Syntax

enableBlockSyntax?: false

Controls parsing of Angular v17+ control flow blocks (@if, @for, @switch).

Enabled (default):

@if (user.isActive) {
  <div>Active user</div>
} @else {
  <div>Inactive user</div>
}

Disabled (for pre-v17):

<div *ngIf="user.isActive; else inactive">Active user</div>
<ng-template #inactive>Inactive user</ng-template>

Let Declarations

enableLetSyntax?: false

Controls parsing of @let variable declarations in templates.

Enabled (default):

@let userName = user.name;
@let userAge = user.age;
<div>{{ userName }} is {{ userAge }} years old</div>

Selectorless Components

enableSelectorless?: true

Allows components without CSS selectors, supported in newer Angular versions.

@Component({
  // No selector property
  template: '<div>Selectorless component</div>'
})
export class MyComponent { }

Angular Core Version

angularCoreVersion?: string

Informs the language service about the Angular version to enable version-specific features and optimizations.

Common versions:

  • "16.2.0" - Legacy support (no control flow blocks)
  • "17.0.0" - Control flow blocks introduction
  • "18.0.0" - Let declarations and other enhancements

Diagnostic Suppression

suppressAngularDiagnosticCodes?: number[]

Suppresses specific Angular diagnostic error codes.

Common error codes:

  • 2345 - Argument type not assignable
  • 2322 - Type not assignable
  • 8030 - Property does not exist
  • 8001 - Schema invalid element (missing component imports)
  • 8004 - Missing pipe
  • 8007 - Missing required inputs
  • 8101 - Invalid banana-in-box syntax
  • 8102 - Unused standalone imports

IDE-Specific Configuration

VS Code Settings

{
  "typescript.preferences.includePackageJsonAutoImports": "auto",
  "typescript.suggest.autoImports": true,
  "angular.experimental-ivy": true,
  "angular.enable-strict-mode-prompt": true
}

WebStorm/IntelliJ Settings

Configure through:

  • File → Settings → Languages & Frameworks → TypeScript
  • Enable "Angular Language Service"
  • Configure plugin options in tsconfig.json

Runtime Configuration

Dynamic Configuration Updates

import { PluginConfig } from "@angular/language-service/api";

// Configuration can be updated at runtime through the plugin module
const newConfig: PluginConfig = {
  angularOnly: false,
  forceStrictTemplates: true,
  suppressAngularDiagnosticCodes: [2345]
};

// Plugin module's onConfigurationChanged method handles updates
plugin.onConfigurationChanged?.(newConfig);

Environment-Based Configuration

// Different configurations for development vs production
const isDevelopment = process.env.NODE_ENV === 'development';

const config: PluginConfig = {
  angularOnly: !isDevelopment, // Allow TypeScript features in development
  forceStrictTemplates: true,
  suppressAngularDiagnosticCodes: isDevelopment ? [2345, 2322] : []
};