MCPcopy Create free account
hub / github.com/breck7/scroll / resolveAutoHints

Function resolveAutoHints

external/.scrollLibs.js:13813–13842  ·  view source on GitHub ↗
(cm, pos)

Source from the content-addressed store, hash-verified

13811 }
13812
13813 function resolveAutoHints(cm, pos) {
13814 var helpers = cm.getHelpers(pos, "hint"),
13815 words
13816 if (helpers.length) {
13817 var resolved = function (cm, callback, options) {
13818 var app = applicableHelpers(cm, helpers)
13819 function run(i) {
13820 if (i == app.length) return callback(null)
13821 fetchHints(app[i], cm, options, function (result) {
13822 if (result && result.list.length > 0) callback(result)
13823 else run(i + 1)
13824 })
13825 }
13826 run(0)
13827 }
13828 resolved.async = true
13829 resolved.supportsSelection = true
13830 return resolved
13831 } else if ((words = cm.getHelper(cm.getCursor(), "hintAtoms"))) {
13832 return function (cm) {
13833 return CodeMirror.hint.fromList(cm, { words: words })
13834 }
13835 } else if (CodeMirror.hint.anyword) {
13836 return function (cm, options) {
13837 return CodeMirror.hint.anyword(cm, options)
13838 }
13839 } else {
13840 return function () {}
13841 }
13842 }
13843
13844 CodeMirror.registerHelper("hint", "auto", {
13845 resolve: resolveAutoHints

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected