diff --git a/lib/utils/linter.js b/lib/utils/linter.js index 5382062..f17baca 100644 --- a/lib/utils/linter.js +++ b/lib/utils/linter.js @@ -13,7 +13,14 @@ function getRange (textEditor, line, col, endLine, endCol, src, lineStart) { return [[line, col], [endLine, endCol]] } - return generateRange(textEditor, line, col) + try { + return generateRange(textEditor, line, col) + } catch (err) { + // If generateRange() fails, the text editor’s contents have most likely + // changed in the meantime. In that case, we simply return a one-character + // range since the results won’t be used anyway. + return [[line, col], [line, col + 1]] + } } module.exports = function (err, output) {