mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Preserve suffix text when applying function suggestion
Updates all PromQL function-like suggestions to omit parentheses when inserted. Such insertions also preserve any suffix text. Related: #13885
This commit is contained in:
@@ -20,8 +20,8 @@ const HISTORY_COUNT_CUTOFF = 1000 * 60 * 60 * 24; // 24h
|
||||
|
||||
const wrapLabel = (label: string) => ({ label });
|
||||
|
||||
const setFunctionMove = (suggestion: CompletionItem): CompletionItem => {
|
||||
suggestion.move = -1;
|
||||
const setFunctionKind = (suggestion: CompletionItem): CompletionItem => {
|
||||
suggestion.kind = 'function';
|
||||
return suggestion;
|
||||
};
|
||||
|
||||
@@ -129,7 +129,7 @@ export default class PromQlLanguageProvider extends LanguageProvider {
|
||||
suggestions.push({
|
||||
prefixMatch: true,
|
||||
label: 'Functions',
|
||||
items: FUNCTIONS.map(setFunctionMove),
|
||||
items: FUNCTIONS.map(setFunctionKind),
|
||||
});
|
||||
|
||||
if (metrics) {
|
||||
|
||||
Reference in New Issue
Block a user