fix: restore proper toggling of autocompleteOnTyping
This commit is contained in:
parent
dfed35c1f4
commit
b4cf010eee
|
@ -27,20 +27,20 @@
|
||||||
const originalHelper = CodeMirror.hint.css || (() => {});
|
const originalHelper = CodeMirror.hint.css || (() => {});
|
||||||
let cssMedia, cssProps, cssPropsValues;
|
let cssMedia, cssProps, cssPropsValues;
|
||||||
|
|
||||||
const aot = prefs.get('editor.autocompleteOnTyping');
|
const AOT_ID = 'autocompleteOnTyping';
|
||||||
CodeMirror.defineOption('autocompleteOnTyping', aot, aotToggled);
|
const AOT_PREF_ID = 'editor.' + AOT_ID;
|
||||||
if (aot) cmFactory.globalSetOption('autocompleteOnTyping', true);
|
const aot = prefs.get(AOT_PREF_ID);
|
||||||
|
CodeMirror.defineOption(AOT_ID, aot, (cm, value) => {
|
||||||
|
cm[value ? 'on' : 'off']('changes', autocompleteOnTyping);
|
||||||
|
cm[value ? 'on' : 'off']('pick', autocompletePicked);
|
||||||
|
});
|
||||||
|
prefs.subscribe(AOT_PREF_ID, (key, val) => cmFactory.globalSetOption(AOT_ID, val), {runNow: aot});
|
||||||
|
|
||||||
CodeMirror.registerHelper('hint', 'css', helper);
|
CodeMirror.registerHelper('hint', 'css', helper);
|
||||||
CodeMirror.registerHelper('hint', 'stylus', helper);
|
CodeMirror.registerHelper('hint', 'stylus', helper);
|
||||||
|
|
||||||
tokenHooks['/'] = tokenizeUsoVariables;
|
tokenHooks['/'] = tokenizeUsoVariables;
|
||||||
|
|
||||||
function aotToggled(cm, value) {
|
|
||||||
cm[value ? 'on' : 'off']('changes', autocompleteOnTyping);
|
|
||||||
cm[value ? 'on' : 'off']('pick', autocompletePicked);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function helper(cm) {
|
async function helper(cm) {
|
||||||
const pos = cm.getCursor();
|
const pos = cm.getCursor();
|
||||||
const {line, ch} = pos;
|
const {line, ch} = pos;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user