From 60776fc78298f20c4b465bba0fdf2be3f8b7186d Mon Sep 17 00:00:00 2001 From: eight Date: Sat, 1 Sep 2018 15:05:29 +0800 Subject: [PATCH] Add: gotoLintIssue --- edit/linter-report.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/edit/linter-report.js b/edit/linter-report.js index b45bca64..eec4bd9c 100644 --- a/edit/linter-report.js +++ b/edit/linter-report.js @@ -30,11 +30,11 @@ var linterReport = (() => { // eslint-disable-line no-var } }); - // document.addEventListener('DOMContentLoaded', () => { - // $('#lint-help').addEventListener('click', showLintHelp); - // $('#lint').addEventListener('click', gotoLintIssue); - // $('#linter-settings').addEventListener('click', showLintConfig); - // }, {once: true}); + document.addEventListener('DOMContentLoaded', () => { + $('#lint-help').addEventListener('click', showLintHelp); + $('#linter-settings').addEventListener('click', showLintConfig); + }, {once: true}); + return {refresh}; function findNextSibling(cms, cm) { @@ -102,7 +102,7 @@ var linterReport = (() => { // eslint-disable-line no-var const message = $create('td', {attributes: {role: 'message'}}); const trElement = $create('tr', { - onclick: () => gotoLintIssue(anno) + onclick: () => gotoLintIssue(cm, anno) }, [ severity, line, @@ -129,9 +129,13 @@ var linterReport = (() => { // eslint-disable-line no-var } } - function showLintHelp() {} + function gotoLintIssue(cm, anno) { + makeSectionVisible(cm); + cm.focus(); + cm.setSelection(anno.from); + } - function gotoLintIssue() {} + function showLintHelp() {} function showLintConfig() {} })();