Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for shell function completion on IDE #859

Closed
aponxi opened this issue Jun 16, 2018 · 5 comments
Closed

Support for shell function completion on IDE #859

aponxi opened this issue Jun 16, 2018 · 5 comments

Comments

@aponxi
Copy link

aponxi commented Jun 16, 2018

This is from WebStorm:
github shelljs autocomplete

None of the functions are completing. Is there a way to type cast or if not can you add a JSDoc friendly function?

In the past I've solved this problem in a few ways. Notable two:

  • Preferred: Created a full JSDoc'ed function for my index script that points to my functions source files. This takes about 1 minute per new method definition or update but also allows accurate source jumping too: I did this by creating a manual list of functions that have the same arguments and call the source. Each time I created or modified the function, I made the same updates to my index script.
  • Quick & Dirty: Created a single file in the project that is not used, pretty much just for the IDE to index and autocomplete

Regards,

@nfischer
Copy link
Member

Thanks for the request! Could you link me to a github project I could open in webstorm which has mixed success at completion (i.e., shelljs doesn't complete, but some other dependency does)?

@aponxi
Copy link
Author

aponxi commented Jun 16, 2018

I don't but I can write instructions here, it's as simple as this:

  • Open Webstorm
  • File > New > Project > choose Empty Project
  • after the project is setup click Terminal on the bottom of the IDE (or open terminal at the project folder) and type:
npm init
npm install shelljs bluebird --save
touch index.js
  • In the index.js this code should highlight the modules besides shelljs:
const Promise = require('bluebird');
const shell = require('shelljs');

shell.echo('hello world');
shell.exec('ls -lart');
Promise.try(()=>{});
shell.which('npm');
Promise.promisifyAll();
  • CTRL + click to go to the source of promisifyAll(), it will give you two options because same function definition exists for browser and server (my opinion is that as long as they have the same arguments it's fine)
  • Also CTRL + click on try() and you'll see 3 options, similarly. I don't think this will happen on shelljs though.

@aponxi
Copy link
Author

aponxi commented Jun 19, 2018

Solved by Downloading the external library from Settings.

@aponxi aponxi closed this as completed Jun 19, 2018
@nfischer
Copy link
Member

Solved by Downloading the external library from Settings.

@aponxi I'm not sure what this means. What is the external library?

@hppycoder
Copy link

Solved by Downloading the external library from Settings.

@aponxi I'm not sure what this means. What is the external library?

WebStorm -> Preferences -> Languages & Frameworks -> JavaScript -> Libraries.
Click on "Download" button and scroll till you see shelljs, click on shelljs, click "Download and Install"

This allows you to download library support manually and worked for getting autocomplete commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants