fix getTokenTypeAt check for some cases

This commit is contained in:
tophf 2019-09-24 17:36:08 +03:00
parent 7b0b4f0850
commit a52ec181ad

View File

@ -501,7 +501,9 @@ function createAppliesToLineWidget(cm) {
const docCur = cm.getSearchCursor('@-moz-document', posStart);
while (docCur.findNext() &&
CodeMirror.cmpPos(docCur.pos.to, posEnd) <= 0) {
if (/\b(string|comment)\b/.test(cm.getTokenTypeAt(docCur.pos.from))) continue;
// CM can be nitpicky at token boundary so we'll check the next character
const safePos = {line: docCur.pos.from.line, ch: docCur.pos.from.ch + 1};
if (/\b(string|comment)\b/.test(cm.getTokenTypeAt(safePos))) continue;
const applies = [];
pos = docCur.pos.to;
do {