Skip to content

Commit 60f1e73

Browse files
committed
Fix tutorial auto-completion
1 parent bb8f6c6 commit 60f1e73

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/node_modules/@stdlib/repl/lib/complete_tutorial.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@
2323
var logger = require( 'debug' );
2424
var parse = require( 'acorn-loose' ).parse;
2525
var startsWith = require( '@stdlib/string/starts-with' );
26+
var objectKeys = require( '@stdlib/utils/keys' );
2627
var tutorialAliasArgs = require( './tutorial_alias_args.js' );
28+
var TUTORIALS = require( './repl_docs.js' ).tutorial;
2729

2830

2931
// VARIABLES //
3032

3133
var debug = logger( 'repl:completer:tutorial' );
34+
var TUTS = objectKeys( TUTORIALS );
3235
var AOPTS = {
3336
'ecmaVersion': 'latest'
3437
};
@@ -48,7 +51,6 @@ var AOPTS = {
4851
* @returns {string} value filter
4952
*/
5053
function complete( out, repl, expression, alias, value ) {
51-
var tuts;
5254
var args;
5355
var ast;
5456
var arg;
@@ -72,12 +74,9 @@ function complete( out, repl, expression, alias, value ) {
7274
}
7375
debug( 'Argument is completable.' );
7476

75-
debug( 'Fetching list of tutorials...' );
76-
tuts = repl._context.tutorial(); // eslint-disable-line no-underscore-dangle
77-
7877
debug( 'Searching for completion candidates...' );
79-
for ( i = 0; i < tuts.length; i++ ) {
80-
t = tuts[ i ];
78+
for ( i = 0; i < TUTS.length; i++ ) {
79+
t = TUTS[ i ];
8180
if ( startsWith( t, value ) ) {
8281
debug( 'Found a completion: %s', t );
8382
out.push( t );

0 commit comments

Comments
 (0)