|
|
@ -568,9 +568,15 @@ export default { |
|
|
|
this.selected = 0 |
|
|
|
this.selected = 0 |
|
|
|
this.suggestion = null |
|
|
|
this.suggestion = null |
|
|
|
const query = getWordUntilCaret(this.$refs.input.$el.querySelector('input')) |
|
|
|
const query = getWordUntilCaret(this.$refs.input.$el.querySelector('input')) |
|
|
|
const parts = query.split(/\W+/) |
|
|
|
// count number of opening curly brackets and closing curly brackets |
|
|
|
this.wordToComplete = parts.pop() |
|
|
|
const cntCurlyBrackets = (this.$refs.input.$el.querySelector('input').value.match(/\{|}/g) || []).reduce((acc, cur) => (acc[cur] = (acc[cur] || 0) + 1, acc), {}) |
|
|
|
this.suggestion = this.acTree.complete(this.wordToComplete)?.sort((x, y) => this.sortOrder[x.type] - this.sortOrder[y.type]) |
|
|
|
if (Math.abs((cntCurlyBrackets['{'] || 0) - (cntCurlyBrackets['}'] || 0))) { |
|
|
|
|
|
|
|
this.suggestion = this.suggestionsList.filter(v => v.type === 'column') |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
const parts = query.split(/\W+/) |
|
|
|
|
|
|
|
this.wordToComplete = parts.pop() |
|
|
|
|
|
|
|
this.suggestion = this.acTree.complete(this.wordToComplete)?.sort((x, y) => this.sortOrder[x.type] - this.sortOrder[y.type]) |
|
|
|
|
|
|
|
} |
|
|
|
this.autocomplete = !!this.suggestion.length |
|
|
|
this.autocomplete = !!this.suggestion.length |
|
|
|
}, |
|
|
|
}, |
|
|
|
selectText() { |
|
|
|
selectText() { |
|
|
|