summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2017-02-26 19:46:18 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2017-02-26 19:46:18 +0100
commit73badd57906358fd0c238dc7764ae86c0ae42bdc (patch)
treee00513a5e461a95683482e02f1503ca41d93a579
parentbef26bc8114bcd9c368df0448eceaa739267819b (diff)
Allow empty popup hints (highlight only)
-rw-r--r--js/codeq/hint.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/js/codeq/hint.js b/js/codeq/hint.js
index e77a3dc..0242443 100644
--- a/js/codeq/hint.js
+++ b/js/codeq/hint.js
@@ -180,6 +180,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
typeHandlers = {
'static': function (template, hint, box) {
+ if (!template) return;
var content = prepareStaticHintContent(template, hint.indices, hint.id),
args = hint ? hint.args : null,
hintIndex = 0,
@@ -251,11 +252,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
codeq.log.debug('Processing popup hint');
var args = hint.args,
style = hint.style || '',
- mark = addMark(hint.start, hint.end, style), // add the mark
langs = codeq.availableLangs,
translations = {},
lang, i, content, htmlPrefix, instFunc;
+ // highlight given range in the editor
+ var mark = addMark(hint.start, hint.end, style);
+ if (!template) return;
+
// execute templates for all languages
for (i = langs.length - 1; i >= 0; i--) {
lang = langs[i];
@@ -337,10 +341,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
continue;
}
hintContent = hintProblemTr[hint.id] || hintCommonTr[hint.id];
- if (!hintContent) {
- codeq.log.error('Hint without content: ' + hint.id);
- continue;
- }
t = typeof hintDef;
if (t === 'string') hintType = hintDef; // currently a hint type is a string