Package APIs

@master/css-language-service

Master CSS Language Service

Public entrypoints

Map Master CSS tooling results to editor documents, language features and syntax highlighting. Use the Shiki entrypoint for server-rendered code presentation.

Declarations show the public surface of each import path. Referenced type names may be local to the package; import only names listed as exports here. Private implementation is omitted, while constructor restrictions remain visible.

@master/css-language-service

Editor document services, settings and trigger characters.

Exports · 15

AT_TRIGGER_CHARACTER

TypeScript
declare const AT_TRIGGER_CHARACTER: "@";

DECLARATION_SEPARATOR_TRIGGER_CHARACTER

TypeScript
declare const DECLARATION_SEPARATOR_TRIGGER_CHARACTER: ";";

defaultLanguageServiceSettings

TypeScript
declare const defaultLanguageServiceSettings: Readonly<MasterCSSLanguageServiceSettings>;

editSyntaxColors

TypeScript
export declare function editSyntaxColors(  this: MasterCSSLanguageService,  document: TextDocument,  color: ColorPresentationParams['color'],  range: ColorPresentationParams['range']): ColorPresentation[];

GROUP_TRIGGER_CHARACTER

TypeScript
declare const GROUP_TRIGGER_CHARACTER: "{";

inspectSyntax

TypeScript
export declare function inspectSyntax(  this: MasterCSSLanguageService,  document: TextDocument,  position: HoverParams['position']): Hover | undefined;

INVOKED_TRIGGER_CHARACTERS

TypeScript
declare const INVOKED_TRIGGER_CHARACTERS: string[];

MasterCSSLanguageService

Complete declaration · 42 lines
TypeScript
export declare class MasterCSSLanguageService implements Disposable {    customSettings: MasterCSSLanguageServiceSettings | undefined;    readonly settings: MasterCSSLanguageServiceSettings;    readonly session: MasterCSSToolingSession;    constructor(      customSettings: MasterCSSLanguageServiceSettings | undefined,      options: MasterCSSLanguageServiceOptions    );    dispose(): void;    [Symbol.dispose](): void;    inspectSyntax(      ...params: Parameters<typeof inspectSyntax>    ): import("vscode-languageserver-protocol").Hover | undefined;    renderSyntaxColors(      ...params: Parameters<typeof renderSyntaxColors>    ): Promise<import("vscode-languageserver-protocol").ColorInformation[]> | undefined;    editSyntaxColors(      ...params: Parameters<typeof editSyntaxColors>    ): import("vscode-languageserver-protocol").ColorPresentation[] | undefined;    formatDirectives(      ...params: Parameters<typeof formatDirectives>    ): import("vscode-languageserver-protocol").TextEdit[] | undefined;    renderSemanticTokens(      ...params: Parameters<typeof renderSemanticTokens>    ): import("vscode-languageserver-protocol").SemanticTokens | undefined;    renderSemanticTokensAtPosition(      ...params: Parameters<typeof renderSemanticTokensAtPosition>    ): import("vscode-languageserver-protocol").SemanticTokens | undefined;    suggestSyntax(      ...params: Parameters<typeof suggestSyntax>    ): import("vscode-languageserver-protocol").CompletionItem[] | undefined;    getClassPositions(document: TextDocument): MasterCSSLanguageClassPosition[];    getClassPosition(      document: TextDocument,      position: Position    ): MasterCSSLanguageClassPosition | undefined;    getClassContextPositions(      document: TextDocument,      position: Position    ): MasterCSSLanguageClassPosition[];    isDocumentAccepted(document: TextDocument): boolean;}

MasterCSSLanguageServiceOptions

TypeScript
export interface MasterCSSLanguageServiceOptions {    session: MasterCSSToolingSession;}

MasterCSSLanguageServiceSettings

@example styles https://regex101.com/r/HLPdsw/1

TypeScript
export interface MasterCSSLanguageServiceSettings {    includedLanguages?: string[];    exclude?: string[];    manifest?: MasterCSSManifest;    classAttributes?: string[];    classFunctions?: string[];    classDeclarations?: string[];    classAttributeBindings?: Record<string, [        string,        string    ] | false>;    embeddedSyntaxHighlighting?: 'active' | 'always' | 'off';    suggestSyntax?: boolean;    inspectSyntax?: boolean;    renderSyntaxColors?: boolean;    editSyntaxColors?: boolean;    formatDirectives?: boolean;}

QUERY_TRIGGER_CHARACTERS

TypeScript
declare const QUERY_TRIGGER_CHARACTERS: string[];

renderSyntaxColors

TypeScript
export declare function renderSyntaxColors(  this: MasterCSSLanguageService,  document: TextDocument): Promise<ColorInformation[]>;

SELECTOR_TRIGGER_CHARACTERS

TypeScript
declare const SELECTOR_TRIGGER_CHARACTERS: string[];

suggestSyntax

TypeScript
export declare function suggestSyntax(  this: MasterCSSLanguageService,  document: TextDocument,  position: CompletionParams['position'],  context: CompletionParams['context']): CompletionItem[] | undefined;

VALUE_TRIGGER_CHARACTERS

TypeScript
declare const VALUE_TRIGGER_CHARACTERS: string[];

@master/css-language-service/common

Shared completion trigger characters.

AT_TRIGGER_CHARACTER

TypeScript
declare const AT_TRIGGER_CHARACTER: "@";

DECLARATION_SEPARATOR_TRIGGER_CHARACTER

TypeScript
declare const DECLARATION_SEPARATOR_TRIGGER_CHARACTER: ";";

GROUP_TRIGGER_CHARACTER

TypeScript
declare const GROUP_TRIGGER_CHARACTER: "{";

INVOKED_TRIGGER_CHARACTERS

TypeScript
declare const INVOKED_TRIGGER_CHARACTERS: string[];

QUERY_TRIGGER_CHARACTERS

TypeScript
declare const QUERY_TRIGGER_CHARACTERS: string[];

SELECTOR_TRIGGER_CHARACTERS

TypeScript
declare const SELECTOR_TRIGGER_CHARACTERS: string[];

VALUE_TRIGGER_CHARACTERS

TypeScript
declare const VALUE_TRIGGER_CHARACTERS: string[];

@master/css-language-service/shiki

Shiki transformer, semantic decorations and language registration.

Exports · 19

createMasterCSSShikiDecorations

TypeScript
export declare function createMasterCSSShikiDecorations(  code: string,  options?: MasterCSSShikiOptions): MasterCSSShikiDecoration[];

createMasterCSSShikiLanguageRegistration

TypeScript
export declare function createMasterCSSShikiLanguageRegistration(): MasterCSSTextMateGrammar & {    injectTo: string[];};

getMasterCSSShikiLanguageId

TypeScript
export declare function getMasterCSSShikiLanguageId(  lang?: string): string | undefined;

isMasterCSSClassListLanguage

TypeScript
export declare function isMasterCSSClassListLanguage(lang?: string): boolean;

isMasterCSSShikiSupportedLanguage

TypeScript
export declare function isMasterCSSShikiSupportedLanguage(lang?: string): boolean;

MASTER_CSS_SHIKI_INJECT_TO

TypeScript
declare const MASTER_CSS_SHIKI_INJECT_TO: readonly [    "source.css",    "source.css.scss",    "source.css.less",    "source.css.postcss"];

MASTER_CSS_SHIKI_SCOPE_NAME

TypeScript
declare const MASTER_CSS_SHIKI_SCOPE_NAME: "master-css.directive.injection";

MASTER_CSS_TEXTMATE_GRAMMAR

TypeScript
declare const MASTER_CSS_TEXTMATE_GRAMMAR: MasterCSSTextMateGrammar;

MasterCSSShikiClassAttributeValueWrapperOptions

TypeScript
export interface MasterCSSShikiClassAttributeValueWrapperOptions {    tagName?: string;    properties?: Record<string, unknown>;    transform?: ShikiDecoration['transform'];}

MasterCSSShikiDecoration

TypeScript
export interface MasterCSSShikiDecoration extends Omit<ShikiDecoration, 'start' | 'end'> {    start: number;    end: number;    type: SemanticTokenType;    role: HighlightTokenRole;    modifiers: SemanticTokenModifier[];}

MasterCSSShikiHighlightRoleStyleKey

TypeScript
export type MasterCSSShikiHighlightRoleStyleKey = HighlightTokenRole;

MasterCSSShikiHighlightRoleStyles

TypeScript
export type MasterCSSShikiHighlightRoleStyles = Partial<Record<MasterCSSShikiHighlightRoleStyleKey, MasterCSSShikiSemanticTokenStyle>>;

masterCSSShikiLanguage

TypeScript
declare const masterCSSShikiLanguage: MasterCSSTextMateGrammar & {    injectTo: string[];};

MasterCSSShikiOptions

Complete declaration · 71 lines
TypeScript
export interface MasterCSSShikiOptions {    /**     * Reuse caller-owned language capabilities. Full tooling sessions also work;     * the transformer never disposes a supplied session.     */    session?: Pick<MasterCSSLanguageSession, 'analyzeDocument' | 'classifyClassNames'>;    /**     * Class-position and manifest settings used when collecting embedded utilities.     */    settings?: MasterCSSLanguageServiceSettings;    /**     * Convenience shortcut for `settings.manifest`.     */    manifest?: MasterCSSManifest;    /**     * Shiki language id. Defaults to the `lang` passed to Shiki.     */    lang?: string;    /**     * Treat the whole source as a whitespace-separated Master CSS class list.     * This replaces the old standalone `.mcss` TextMate grammar use case     * without contributing a Master CSS language.     */    classList?: boolean;    /**     * Class prefix added to every semantic decoration.     *     * @default 'mcss-semantic'     */    classPrefix?: string;    /**     * Add `data-semantic-token-*` attributes to decorated spans.     *     * @default true     */    dataAttributes?: boolean;    /**     * Force Shiki to wrap semantic tokens instead of reusing the existing     * TextMate token span when possible.     */    alwaysWrap?: boolean;    /**     * Wrap each embedded class attribute/string value with its original host     * language token presentation while keeping Master CSS semantic spans nested     * inside it.     *     * @default true     */    classAttributeValueWrapper?: boolean | MasterCSSShikiClassAttributeValueWrapperOptions;    /**     * Inline styles applied by semantic token type or type.modifier. These     * styles intentionally replace the underlying TextMate token style for the     * decorated range, which keeps tokens such as `block` and `block:hover`     * visually aligned when they share the same semantic type.     */    semanticTokenStyles?: MasterCSSShikiSemanticTokenStyles;    /**     * Inline styles applied by CSS-native highlight role. Role styles are the     * most precise presentation override and are shared across host languages.     */    highlightRoleStyles?: MasterCSSShikiHighlightRoleStyles;    /**     * Resolve Master CSS semantic token scopes through the active Shiki     * theme when possible. When disabled, the transformer only splits tokens     * and attaches semantic metadata/classes unless explicit semantic styles     * are provided.     *     * @default true     */    matchCSSSyntaxStyles?: boolean;}

MasterCSSShikiSemanticTokenStyle

TypeScript
export type MasterCSSShikiSemanticTokenStyle = string | Record<string, string>;

MasterCSSShikiSemanticTokenStyleKey

TypeScript
export type MasterCSSShikiSemanticTokenStyleKey = SemanticTokenType | `${SemanticTokenType}.${SemanticTokenModifier}`;

MasterCSSShikiSemanticTokenStyles

TypeScript
export type MasterCSSShikiSemanticTokenStyles = Partial<Record<MasterCSSShikiSemanticTokenStyleKey, MasterCSSShikiSemanticTokenStyle>>;

MasterCSSTextMateGrammar

TypeScript
export interface MasterCSSTextMateGrammar {    name: string;    scopeName: string;    injectionSelector: string;    patterns: any[];    repository: Record<string, any>;    [key: string]: any;}

transformerMasterCSS

TypeScript
export declare function transformerMasterCSS(  options?: MasterCSSShikiOptions): ShikiTransformer;

@master/css-language-service/syntaxes/master-css.tmLanguage.json

TextMate grammar asset for directive highlighting.

Published asset mapping:

JSON
"./syntaxes/master-css.tmLanguage.json"

Using this contract

Supply a tooling session when creating MasterCSSLanguageService. Shiki helpers accept a reusable language session or manifest through their options. See Language Service for configuration and examples.


© 2026 Aoyue Design LLC.MIT License
Trademark Policy