Skip to content

Commit

Permalink
fix: function info in expression builder
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Jan 20, 2024
1 parent 90a6c2f commit 1fab37a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/src/query/visual/ExpressionBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const codeViewUpdate = debounce(function ({ cursorPos: _cursorPos }) {
const tokens = parse(rawExpression.value).tokens
const token = tokens
.filter((t) => t.type == 'FUNCTION' && t.start < _cursorPos && t.end > _cursorPos)
.filter((t) => t.type == 'FUNCTION' && t.start < _cursorPos && t.end >= _cursorPos)
.at(-1)
if (token) {
Expand All @@ -55,8 +55,10 @@ const codeViewUpdate = debounce(function ({ cursorPos: _cursorPos }) {
function onSuggestionSelect(item) {
const raw = rawExpression.value || ''
const start = suggestionContext.from
const end = suggestionContext.to
const start = isNaN(suggestionContext.from)
? codeEditor.value.cursorPos
: suggestionContext.from
const end = isNaN(suggestionContext.to) ? codeEditor.value.cursorPos : suggestionContext.to
if (item.suggestionType === 'function') {
const textBeforeToken = raw.slice(0, start)
Expand Down

0 comments on commit 1fab37a

Please sign in to comment.