diff --git a/src/js/1p-filters.js b/src/js/1p-filters.js index 647d48cdf..e02de5df2 100644 --- a/src/js/1p-filters.js +++ b/src/js/1p-filters.js @@ -61,12 +61,11 @@ let cachedUserFilters = ''; const responseHandler = function(response) { if ( response instanceof Object === false ) { return; } if ( response.hintUpdateToken !== undefined ) { - const firstVisit = hintUpdateToken === 0; const mode = cmEditor.getMode(); if ( mode.setHints instanceof Function ) { - mode.setHints(response, firstVisit); + mode.setHints(response); } - if ( firstVisit ) { + if ( hintUpdateToken === 0 ) { mode.parser.expertMode = response.expertMode !== false; } hintUpdateToken = response.hintUpdateToken; diff --git a/src/js/asset-viewer.js b/src/js/asset-viewer.js index 54fef4599..ecdef01c2 100644 --- a/src/js/asset-viewer.js +++ b/src/js/asset-viewer.js @@ -66,7 +66,7 @@ if ( hints instanceof Object ) { const mode = cmEditor.getMode(); if ( mode.setHints instanceof Function ) { - mode.setHints(hints, true); + mode.setHints(hints); } } diff --git a/src/js/codemirror/ubo-static-filtering.js b/src/js/codemirror/ubo-static-filtering.js index 78a8710c5..183af0909 100644 --- a/src/js/codemirror/ubo-static-filtering.js +++ b/src/js/codemirror/ubo-static-filtering.js @@ -35,6 +35,7 @@ const scriptletNames = new Map(); const preparseDirectiveTokens = new Map(); const preparseDirectiveHints = []; const originHints = []; +let hintHelperRegistered = false; /******************************************************************************/ @@ -361,7 +362,7 @@ CodeMirror.defineMode('ubo-static-filtering', function() { style = style.trim(); return style !== '' ? style : null; }, - setHints: function(details, firstVisit = false) { + setHints: function(details) { if ( Array.isArray(details.redirectResources) ) { for ( const [ name, desc ] of details.redirectResources ) { const displayText = desc.aliasOf !== '' @@ -389,7 +390,8 @@ CodeMirror.defineMode('ubo-static-filtering', function() { originHints.push(hint); } } - if ( firstVisit ) { + if ( hintHelperRegistered === false ) { + hintHelperRegistered = true; initHints(); } },