Loki: fix filter expression suggestions (#21290)

* Loki: fix filter expression suggestions

- dont suggest term completion items in filter expression
- allow at least one character before suggesting term items
- keep logql expression when switching between Metrics/Logs mode
- show only history by default in completion items

* Clear results when changing mode
This commit is contained in:
David
2019-12-31 09:53:30 +01:00
committed by GitHub
parent 334b89f3ee
commit 3667781e6f
6 changed files with 47 additions and 36 deletions

View File

@@ -146,7 +146,7 @@ export default class PromQlLanguageProvider extends LanguageProvider {
// Prevent suggestions in `function(|suffix)`
const noSuffix = !nextCharacter || nextCharacter === ')';
// Empty prefix is safe if it does not immediately follow a complete expression and has no text after it
// Prefix is safe if it does not immediately follow a complete expression and has no text after it
const safePrefix = prefix && !text.match(/^[\]})\s]+$/) && noSuffix;
// About to type next operand if preceded by binary operator