how to configure code completion suggestions to include external JS library only

Hi,

Is it possible to configure code completion suggestions?

I'd like to add casperjs library and see JavaScript suggestions only.

This is what I see.... Java, Java Script, Groovy.. everything

 

This is what I want to see - casper.js methods only.

0
6 comments

You need to exclude the directory where all your other libraries reside from indexing (Mark directory as/Excluded) and then add casper.js to JavaScript libraries in Settings | Languages & Frameworks | JavaScript | Libraries

See https://blog.jetbrains.com/webstorm/2014/07/how-webstorm-works-completion-for-javascript-libraries/

0
Avatar
Permanently deleted user

Hi @Elena,

That worked.

But I've got a new issue.

 

The autocompletion works for "new Casper()" defined objects only.

casper = new Casper();

 

In my case casper is not defined in the code itself but by maven configuration.

 

Is there a way to instruct InteliJ using a comments or configuration file,  so casper variable would use casper.js for autocompletion.

If not that is a great feature that could be added.

 

 

0

haven't got what you mean,sorry... do you mean that `casper` var is not defined/assigned anywhere in your code? You can try using JSDoc comment then, like

/**
* @name casper
* @type {Casper}
*/
0
Avatar
Permanently deleted user

yes I meant that, var casper is not defined in my code but injected using maven

 

The JSDoc works partially 

Doesn't work using casper name

 

But when I rename the name it works - but that is not a solution

 

 

0

this happens because the `casper` variable is already defined somewhere, and is used when completing methods instead of the var defined in JSDoc... For example, with casperjs installed via NPM, it's defined in samples folder... I was able to get rid of the issue by excluding all files it's defined in, so that the only file added to libraries is `node_modules\casperjs\modules\casper.js`

0
Avatar
Permanently deleted user

Thank you  :)

That fixed the issue.

 

0

Please sign in to leave a comment.