diff --git a/edit/lint.js b/edit/lint.js index c3dbf56c..8c7b1ad7 100644 --- a/edit/lint.js +++ b/edit/lint.js @@ -188,18 +188,18 @@ function updateLintReport(cm, delay) { const info = mark.__annotation; const isActiveLine = info.from.line === cm.getCursor().line; const pos = isActiveLine ? 'cursor' : (info.from.line + ',' + info.from.ch); - // stylelint rule added in parentheses at the end; extract it out for the stylelint info popup - const lintRuleName = info.message - .substring(info.message.lastIndexOf('('), info.message.length) - .replace(/[()]/g, ''); - const title = escapeHtml(info.message); - const message = title.length > 100 ? title.substr(0, 100) + '...' : title; + // rule name added in parentheses at the end; extract it out for the info popup + const text = info.message; + const parenPos = text.endsWith(')') ? text.lastIndexOf('(') : text.length; + const ruleName = text.slice(parenPos + 1, -1); + const title = escapeHtml(text); + const message = escapeHtml(text.substr(0, Math.min(100, parenPos)), {limit: 100}); if (isActiveLine || oldMarkers[pos] === message) { delete oldMarkers[pos]; } newMarkers[pos] = message; return `