Skip to content

Commit d1cd2de

Browse files
committed
Update tutorial
1 parent 50f249e commit d1cd2de

1 file changed

Lines changed: 83 additions & 4 deletions

File tree

lib/node_modules/@stdlib/repl/docs/tutorials/read_eval_print_loop.txt

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,19 +334,98 @@ other variable within the top-level scope.
334334

335335
---
336336

337-
TODO: vars()
337+
Another common occurrence during iterative development within a REPL
338+
environment is forgetting variable names or failing to remember what
339+
variables have already been declared.
340+
341+
Thankfully, you can run
342+
343+
```javascript
344+
vars()
345+
```
346+
347+
to return a list of user-defined variable names. For additional variable
348+
details, run
349+
350+
```javascript
351+
help( vars )
352+
```
353+
354+
to see function options.
338355

339356
---
340357

341-
TODO: TAB completion (FS APIs)
358+
To facilitate working with long variable names and nested property access,
359+
the REPL supports \*TAB\s completion.
360+
361+
For example, enter
362+
363+
```javascript
364+
base.rand
365+
```
366+
367+
followed by \*TAB\s to generate a list of auto-completions.
342368

343369
---
344370

345-
TODO: TAB completion (computed properties)
371+
Similarly, if you create a nested object
372+
373+
```javascript
374+
var obj = { 'beep': { 'boop': { 'foo': 'bar' } } };
375+
```
376+
377+
and then enter
378+
379+
```javascript
380+
obj.beep.b
381+
```
382+
383+
followed by \*TAB\s, the nested property \*boop\s should auto-complete.
346384

347385
---
348386

349-
TODO: TAB completion (local scope)
387+
\*TAB\s completion also works with computed properties. For example, enter
388+
389+
```javascript
390+
obj[ 'beep' ][ 'b
391+
```
392+
393+
followed by \*TAB\s to auto-complete the nested property \*boop\s as done
394+
in the previous slide.
395+
396+
---
397+
398+
For select APIs interacting with the filesystem, \*TAB\s completion is
399+
supported for file paths.
400+
401+
For example, enter
402+
403+
```javascript
404+
readFile.sync( './
405+
```
406+
407+
followed by \*TAB\s to generate a list of applicable file paths.
408+
409+
---
410+
411+
Additionally, \*TAB\s completion is supported for variables defined in a
412+
nested scope.
413+
414+
For example, enter
415+
416+
```javascript
417+
function foo() { var beep = 5; be
418+
```
419+
420+
followed by \*TAB\s to auto-complete the variable \*beep\s.
421+
422+
Similarly, entering
423+
424+
```javascript
425+
function foo( beep ) { console.log( be
426+
```
427+
428+
followed by \*TAB\s auto-completes the parameter \*beep\s.
350429

351430
---
352431

0 commit comments

Comments
 (0)