You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've had problems getting auto completion to work for a while now. Today I finally found the cause.
The documentation states that to enable autocompletion you should pass an array of completers as value for enableLiveAutoCompletion in setOptions.
The exact wording is:
Enable live autocomplete. If the value is an array, it is assumed to be an array of completers and will use them instead of the default completers.
After debugging this for a while today I concluded that this is simply not what Ace does. After looking at the code I saw that indeed, the actual implementation is:
enableLiveAutocompletion: {set: function(val){if(val){if(!this.completers)this.completers=Array.isArray(val)? val: completers;// On each change automatically trigger the autocompletethis.commands.on('afterExec',doLiveAutocomplete);}else{this.commands.removeListener('afterExec',doLiveAutocomplete);}},value: false},
The documentation should instead state:
Enable live autocomplete. If the value is an array, it is assumed to be an array of completers and will use them unless you already have completers set e.g. from enableBasicAutocompletion.
Note: enableBasicAutocompletion has the same logic, however this is completely undocumented. There the documentation should read:
Enable basic autocomplete. If the value is an array, it is assumed to be an array of completers and will use them unless you already have completers set e.g. from enableLiveAutocompletion.
After all this, I actually don't know how I'm supposed to set the completers, so for now I just grab the underlying array pointer and force the extra completers in there. It seems to work, but feels like unnecessary cruelty to the editor, and probably bypasses several set-up side-effects.
Thank you.
From the comments on the commits, I it seems direct direct access to Editor.completers is the intended usage. From the way the API was structured, it seemed to me that this was a “dangerous” shortcut. Many other properties have dedicated get/set functions, but completers one doesn't have any other than these setOptions options.
Describe the issue
We've had problems getting auto completion to work for a while now. Today I finally found the cause.
The documentation states that to enable autocompletion you should pass an array of completers as value for
enableLiveAutoCompletion
insetOptions
.The exact wording is:
After debugging this for a while today I concluded that this is simply not what Ace does. After looking at the code I saw that indeed, the actual implementation is:
The documentation should instead state:
Note:
enableBasicAutocompletion
has the same logic, however this is completely undocumented. There the documentation should read:After all this, I actually don't know how I'm supposed to set the completers, so for now I just grab the underlying array pointer and force the extra completers in there. It seems to work, but feels like unnecessary cruelty to the editor, and probably bypasses several set-up side-effects.
Links
https://ajaxorg.github.io/ace-api-docs/interfaces/Ace.EditorOptions.html#enableLiveAutocompletion
The text was updated successfully, but these errors were encountered: