import { IJSONSchema } from '@opensumi/ide-core-common/lib/json-schema'; import { Color } from './color'; import { ITokenColorizationSetting } from './theme.service'; export declare const ISemanticTokenRegistry: unique symbol; export declare const TOKEN_TYPE_WILDCARD = "*"; export declare const TOKEN_CLASSIFIER_LANGUAGE_SEPARATOR = ":"; export declare const CLASSIFIER_MODIFIER_SEPARATOR = "."; export type TokenClassificationString = string; export declare const idPattern = "\\w+[-_\\w+]*"; export declare const typeAndModifierIdPattern = "^\\w+[-_\\w+]*$"; export declare const selectorPattern = "^(\\w+[-_\\w+]*|\\*)(\\.\\w+[-_\\w+]*)*(\\:\\w+[-_\\w+]*)?$"; export declare const fontStylePattern = "^(\\s*(italic|bold|underline))*\\s*$"; export interface TokenSelector { match(type: string, modifiers: string[], language: string): number; readonly id: string; } export interface SemanticTokenDefaultRule { selector: TokenSelector; defaults: TokenStyleDefaults; } export interface TokenTypeOrModifierContribution { readonly num: number; readonly id: string; readonly superType?: string; readonly description: string; readonly deprecationMessage?: string; } export interface TokenStyleData { foreground?: Color; bold?: boolean; underline?: boolean; italic?: boolean; } export declare class TokenStyle implements Readonly { readonly foreground?: Color | undefined; readonly bold?: boolean | undefined; readonly underline?: boolean | undefined; readonly italic?: boolean | undefined; constructor(foreground?: Color | undefined, bold?: boolean | undefined, underline?: boolean | undefined, italic?: boolean | undefined); } export declare namespace TokenStyle { function toJSONObject(style: TokenStyle): any; function fromJSONObject(obj: any): TokenStyle | undefined; function equals(s1: any, s2: any): boolean; function is(s: any): s is TokenStyle; function fromData(data: { foreground?: Color; bold?: boolean; underline?: boolean; italic?: boolean; }): TokenStyle; function fromSettings(foreground: string | undefined, fontStyle: string | undefined, bold?: boolean, underline?: boolean, italic?: boolean): TokenStyle; } export interface SemanticTokenRule { style: TokenStyle; selector: TokenSelector; } export interface ITextMateThemingRule { name?: string; scope?: string | string[]; settings: ITokenColorizationSetting; } export type TokenStyleDefinition = SemanticTokenRule | ProbeScope[] | TokenStyleValue; export type TokenStyleDefinitions = { [P in keyof TokenStyleData]?: TokenStyleDefinition | undefined; }; export type TextMateThemingRuleDefinitions = { [P in keyof TokenStyleData]?: ITextMateThemingRule | undefined; } & { scope?: ProbeScope; }; /** * A TokenStyle Value is either a token style literal, or a TokenClassificationString */ export type TokenStyleValue = TokenStyle | TokenClassificationString; export type ProbeScope = string[]; export type Matcher = (matcherInput: T) => number; export declare const noMatch: (_scope: ProbeScope) => number; export declare function nameMatcher(identifiers: string[], scope: ProbeScope): number; export interface MatcherWithPriority { matcher: Matcher; priority: -1 | 0 | 1; } export declare function createMatchers(selector: string, matchesName: (names: string[], matcherInput: T) => number, results: MatcherWithPriority[]): void; export interface TokenStyleDefaults { scopesToProbe?: ProbeScope[]; light?: TokenStyleValue; dark?: TokenStyleValue; hc?: TokenStyleValue; } export interface ISemanticTokenRegistry { /** * Parses a token selector from a selector string. * @param selectorString selector string in the form (*|type)(.modifier)* * @param language language to which the selector applies or undefined if the selector is for all language * @returns the parsed selector * @throws an error if the string is not a valid selector */ parseTokenSelector(selectorString: string, language?: string): TokenSelector; /** * Register a TokenStyle default to the registry. * @param selector The rule selector * @param defaults The default values */ registerTokenStyleDefault(selector: TokenSelector, defaults: TokenStyleDefaults): void; /** * Deregister a TokenStyle default to the registry. * @param selector The rule selector */ deregisterTokenStyleDefault(selector: TokenSelector): void; /** * The styling rules to used when a schema does not define any styling rules. */ getTokenStylingDefaultRules(): SemanticTokenDefaultRule[]; /** * Register a token type to the registry. * @param id The TokenType id as used in theme description files * @param description the description */ registerTokenType(id: string, description: string, superType?: string, deprecationMessage?: string): void; /** * Register a token modifier to the registry. * @param id The TokenModifier id as used in theme description files * @param description the description */ registerTokenModifier(id: string, description: string, deprecationMessage?: string): void; } export declare function parseClassifierString(s: string, defaultLanguage: string): { type: string; modifiers: string[]; language: string; }; export declare function parseClassifierString(s: string, defaultLanguage?: string): { type: string; modifiers: string[]; language: string | undefined; }; export declare function getStylingSchemeEntry(description?: string, deprecationMessage?: string): IJSONSchema; //# sourceMappingURL=semantic-tokens-registry.d.ts.map