Skip to content

Commit

Permalink
Made the TextMate warnings customizable.
Browse files Browse the repository at this point in the history
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
  • Loading branch information
Akos Kitta committed Aug 24, 2020
1 parent b10fec5 commit df35d8a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/monaco/src/browser/textmate/textmate-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class TextmateRegistry {
if (existingProvider) {
Promise.all([existingProvider.getGrammarDefinition(), provider.getGrammarDefinition()]).then(([a, b]) => {
if (a.location !== b.location || !a.location && !b.location) {
console.warn(new Error(`a registered grammar provider for '${scope}' scope is overridden`));
this.warn(`a registered grammar provider for '${scope}' scope is overridden`);
}
});
}
Expand All @@ -79,7 +79,7 @@ export class TextmateRegistry {
const scopes = this.languageIdToScope.get(languageId) || [];
const existingScope = scopes[0];
if (typeof existingScope === 'string') {
console.warn(new Error(`'${languageId}' language is remapped from '${existingScope}' to '${scope}' scope`));
this.warn(`'${languageId}' language is remapped from '${existingScope}' to '${scope}' scope`);
}
scopes.unshift(scope);
this.languageIdToScope.set(languageId, scopes);
Expand Down Expand Up @@ -109,7 +109,7 @@ export class TextmateRegistry {
const configs = this.languageToConfig.get(languageId) || [];
const existingConfig = configs[0];
if (existingConfig) {
console.warn(new Error(`a registered grammar configuration for '${languageId}' language is overridden`));
this.warn(`a registered grammar configuration for '${languageId}' language is overridden`);
}
configs.unshift(config);
this.languageToConfig.set(languageId, configs);
Expand All @@ -125,4 +125,9 @@ export class TextmateRegistry {
const configs = this.languageToConfig.get(languageId);
return configs && configs[0] || {};
}

protected warn(message: string): void {
console.warn(new Error(message));
}

}

0 comments on commit df35d8a

Please sign in to comment.