support [[var]] notation

This commit is contained in:
Mitsuhiro Tanda 2018-03-15 17:23:28 +09:00
parent f03da8bb3a
commit 10012f8ffe

View File

@ -13,14 +13,24 @@ export class PromCompleter {
this.labelQueryCache = {};
this.labelNameCache = {};
this.labelValueCache = {};
this.templateVariableCompletions = this.templateSrv.variables.map(variable => {
return {
caption: '$' + variable.name,
value: '$' + variable.name,
meta: 'variable.other',
score: Number.MAX_VALUE,
};
});
this.templateVariableCompletions = _.flatten(
this.templateSrv.variables.map(variable => {
return [
{
caption: '$' + variable.name,
value: '$' + variable.name,
meta: 'variable.other',
score: Number.MAX_VALUE,
},
{
caption: '[[' + variable.name + ']',
value: '[[' + variable.name + ']',
meta: 'variable.other',
score: Number.MAX_VALUE,
},
];
})
);
}
getCompletions(editor, session, pos, prefix, callback) {