Loki: Fix lookup for label key token (#19579)

(cherry picked from commit 5238faf6da)
This commit is contained in:
Andrej Ocenas
2019-10-08 02:10:35 -07:00
committed by Hugo Häggmark
parent 4437f8af26
commit 54a092e0a1
@@ -226,14 +226,16 @@ const handleTypeahead = debounce(
)
.toArray();
// Find the first label key to the left of the cursor
const labelKeyDec = decorations
.filter(
decoration =>
decoration.end.offset === myOffset &&
.filter(decoration => {
return (
decoration.end.offset <= myOffset &&
decoration.type === TOKEN_MARK &&
decoration.data.get('className').includes('label-key')
)
.first();
);
})
.last();
const labelKey = labelKeyDec && value.focusText.text.slice(labelKeyDec.start.offset, labelKeyDec.end.offset);