kopia lustrzana https://github.com/c9/core
Consider match success if input seemed to be a noop
rodzic
bfd5aa7f44
commit
a734df504e
|
@ -409,6 +409,10 @@ define(function(require, exports, module) {
|
||||||
if (isOptionalOnly(predictions))
|
if (isOptionalOnly(predictions))
|
||||||
return done(null, []);
|
return done(null, []);
|
||||||
|
|
||||||
|
// No matches. But it seems we got a noop input. Our predictions likely happen later.
|
||||||
|
if (matchPrediction(new NoopCommand()))
|
||||||
|
return done(null, []);
|
||||||
|
|
||||||
// No matches for our predictions :( We likely made a mistake.
|
// No matches for our predictions :( We likely made a mistake.
|
||||||
// Reporting false here ensures we catch mistakes early.
|
// Reporting false here ensures we catch mistakes early.
|
||||||
return done(null, false);
|
return done(null, false);
|
||||||
|
@ -700,6 +704,26 @@ define(function(require, exports, module) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Noop command. Factory method: tryCreate().
|
||||||
|
*/
|
||||||
|
NoopCommand.tryCreate = function() {
|
||||||
|
var result = new NoopCommand();
|
||||||
|
result.before = { predict: predictLine, predictIndex: predictIndex };
|
||||||
|
result.after = { predict: predictLine, predictIndex: predictIndex };
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
function NoopCommand() {
|
||||||
|
var outputText = predictIndex ? getCursorLeft(predictIndex) : "";
|
||||||
|
return {
|
||||||
|
$outputText: outputText,
|
||||||
|
do: function() {
|
||||||
|
echo(outputText);
|
||||||
|
predictIndex = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Predictor API
|
// Predictor API
|
||||||
return {
|
return {
|
||||||
get state() { return state; },
|
get state() { return state; },
|
||||||
|
|
Ładowanie…
Reference in New Issue