From 73badd57906358fd0c238dc7764ae86c0ae42bdc Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 26 Feb 2017 19:46:18 +0100 Subject: Allow empty popup hints (highlight only) --- js/codeq/hint.js | 10 +++++----- 1 file 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 . */ 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 . */ 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 . */ 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 -- cgit v1.2.1