Tempo: Map the status tag to status.code for autocomplete (#54593)

This commit is contained in:
Hamas Shafiq 2022-09-02 11:55:55 +01:00 committed by GitHub
parent 3cf8e9c72e
commit 21dd60ba60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,6 +72,15 @@ export class CompletionProvider implements monacoTypes.languages.CompletionItemP
tags.forEach((t) => (this.tags[t] = new Set<string>())); tags.forEach((t) => (this.tags[t] = new Set<string>()));
} }
private overrideTagName(tagName: string): string {
switch (tagName) {
case 'status':
return 'status.code';
default:
return tagName;
}
}
/** /**
* Get suggestion based on the situation we are in like whether we should suggest tag names or values. * Get suggestion based on the situation we are in like whether we should suggest tag names or values.
* @param situation * @param situation
@ -104,7 +113,8 @@ export class CompletionProvider implements monacoTypes.languages.CompletionItemP
type: 'OPERATOR' as CompletionType, type: 'OPERATOR' as CompletionType,
})); }));
case 'SPANSET_IN_VALUE': case 'SPANSET_IN_VALUE':
return await this.languageProvider.getOptions(situation.tagName).then((res) => { const tagName = this.overrideTagName(situation.tagName);
return await this.languageProvider.getOptions(tagName).then((res) => {
const items: Completion[] = []; const items: Completion[] = [];
res.forEach((val) => { res.forEach((val) => {
if (val?.label) { if (val?.label) {