From 3ed98cb506899e6fdebd82edaa90edaaf5f720d7 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 25 Nov 2017 04:29:56 +0300 Subject: [PATCH] fixup 80547aef: autocomplete should fallback to original helper --- edit/codemirror-default.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/edit/codemirror-default.js b/edit/codemirror-default.js index f9c6f248..1c532e5a 100644 --- a/edit/codemirror-default.js +++ b/edit/codemirror-default.js @@ -133,16 +133,18 @@ }); })(); -(() => { +// eslint-disable-next-line no-unused-expressions +CodeMirror.hint && (() => { const USO_VAR = 'uso-variable'; const USO_VALID_VAR = 'variable-3 ' + USO_VAR; const USO_INVALID_VAR = 'error ' + USO_VAR; + const originalHelper = CodeMirror.hint.css || (() => {}); CodeMirror.registerHelper('hint', 'css', function (cm) { const {line, ch} = cm.getCursor(); const {styles, text} = cm.getLineHandle(line); if (!styles || !editor) { - return; + return originalHelper(cm); } let prev = 0; for (let i = 1; i < styles.length; i += 2) { @@ -155,7 +157,6 @@ const leftPart = text.slice(prev, ch); const list = Object.keys(editor.getStyle().usercssData.vars) .filter(name => name.startsWith(leftPart)); - console.log(leftPart, ...list); return { list, from: {line, ch: prev}, @@ -164,6 +165,7 @@ } prev = end; } + return originalHelper(cm); }); const hooks = CodeMirror.mimeModes['text/css'].tokenHooks;