Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sails.js intellisense in Webstorm

is there any available intellisense for Webstorm for Sails.js app? In all my controllers, I get message that the model is undefined, even though it works perfectly. The same goes with calling services.

like image 875
Martin Vavrečka Avatar asked Mar 14 '14 11:03

Martin Vavrečka


People also ask

How do I add a library to WebStorm?

Press Ctrl+Alt+S to open the IDE settings and select Languages & Frameworks | JavaScript | Libraries. On the Libraries page that opens, click Download and in the Download Library dialog that opens, select the required library, and click Download and Install.

Is PhpStorm good for JavaScript?

With PhpStorm, you can develop modern web, mobile, and desktop applications with JavaScript and Node. js. PhpStorm also supports React, Angular, Vue. js, and other frameworks and provides tight integration with various tools for web development.

What is code completion in typescript?

Code completion is one of the essential features of the WebStorm editor. To show you completion suggestions, WebStorm goes through the project files with the source code and adds classes, methods, functions, and variables defined in them to a special internal index.


2 Answers

i know this is a little old, but what i ended up doing was first naming all "modules.exports" definitions with the same name of the file (like a class name).

So if i have a file named UserController.js, i would start it with:

var UserController = module.exports = {}

Next, you need to go to the preferences page and hook up your sails api folder as a library. javascript libraries settings page

  • Just go Preferences->Languages and Frameworks->Javascript->Libraries
  • Click add
  • Click the little + icon on the left bottom part of the dialog
  • Browse to the sails api folder (where your controllers and models are)
  • Click OK

You will notice that the icon for api files now has some books on them.

Also, make sure that your "Node.js Globals" is enabled as well as the "node_modules" folder of your sails project. that will enable code completion on common node.js stuff and on sails dependencies (waterline, ejs, etc).

Hope that helps and vote for official support!

like image 153
guinetik Avatar answered Oct 13 '22 23:10

guinetik


This framework is not currently supported - please vote for http://youtrack.jetbrains.com/issue/WEB-11025. And WebStorm doesn't support its way of loading modules and thus can't provide intellisense

like image 2
lena Avatar answered Oct 13 '22 23:10

lena