Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tab-completion for V8 interpreter?

Tags:

javascript

v8

I'm using V8 javascript interpreter on the command line but it has no tab-completion.

Is it possible to add it somehow?

like image 269
never_had_a_name Avatar asked Jul 30 '26 18:07

never_had_a_name


2 Answers

I presume you mean the shell sample? (scons sample=shell). It doesn't support tab completion out of the box (there's no config option, etc.), but if you are comfortable with C/C++, it should be relatively trivial to enhance it to add tab completion using GNU Readline.

Likely it doesn't use readline by default because of licensing issues (and why introduce the dependency for a sample), but that doesn't stop you from supporting it in your installation.

like image 169
Nick Bastin Avatar answered Aug 01 '26 07:08

Nick Bastin


The example 'shell' is a toy application only meant to demo v8 development.

These instructions show how to build d8 (the v8 developer console) with readline support. This will work for Ubuntu/Debian. For other distributions, you will need to replace the apt-get command with whatever package tool you have available.

sudo apt-get install svn scons libreadline-dev
svn co http://v8.googlecode.com/svn/trunk v8
cd v8/
scons console=readline d8

More complete documentation here: http://code.google.com/apis/v8/build.html

like image 39
bukzor Avatar answered Aug 01 '26 08:08

bukzor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!