Intellisense not working with module structure

I used to have no problem with IntelliSense, I would just load up the references in the settings>javascript>frameworks and libraries. Currently, I am working on a project that is all in modules, I have the require.config statement right in the file. The path references are not able to point to a local location, they point to a location that is relative to where they are uploaded to. I have no IntelliSense. I tried changing the references in the settings to Global Scope hoping that would help but it did not. How can I get the IntelliSense back? 

 

Any help would be great thanks 

10 comments
Comment actions Permalink

`require.config` is not currently respected when resolving paths - please see https://youtrack.jetbrains.com/issue/WEB-12432 and linked tickets. Unfortunately I'd say that AMD support in WebStorm is rather poor (may be because there no much demand for it currently)

0
Comment actions Permalink

I actually figured it out, Webstorm didn't like me aliasing underscore to an '_', once I listed just underscore in the function everything was fine. What you are referring to may have something to do with recognizing he packages through the path statement, but I am loading them as global typed definitions, that should override the paths I would think. In any event I am fine so thanks 

0
Comment actions Permalink

I have a similar problem, we use AMD, and I think a lot of people use it because we have to maintain legacy projects. WebStorm is confused about "underscore" I have done a lot of things ( symlinking the vendor libs to make it match the requireJS path config during development, installing TypedDefinition from the libraries window, adding custom libraries pointing to the actual module file and probably others) trying to figured out how to make WebStorm find the references to the modules. I think the libraries and scopes should be honored, if AMD support is poor then at least honor the libraries configuration. I've been wondering around the web trying to find a solution to this for weeks and finally got here.

0
Comment actions Permalink

>WebStorm is confused about "underscore"

 

please can you elaborate on this? code snippets/files that can be used to recreate the issue would be helpful

0
Comment actions Permalink

I'm gonna try, I don't know how to do code syntax in here.

// config.js
{

  ...

   "knockout": "path/to/knockout",

  "underscore": "path/to/underscore", // if we change this to "underline": ... instead it works correctly WebStorm finds the methods for underscore correctly

  ...

}

 

 

// module A

// when we do Ctrl+B or Ctrl+Click on the "underscore" dependency if finds multiple implementations one in bower_components dir, another in the path config and some others, if we defined with a different name in the config it works, but we can't do that at this point

define(["knockout", "underscore"], function(ko, _) {

  // here WebStorm finds ko.observable method/function

  var observable1 = ko.observable();

  // here WebStorm can't find the _.each method inside of underscore

  _.each([1,2,3,4,5], function(n) { // do something with the number });

});

0
Comment actions Permalink

works for me
("underscore": "^1.8.3"), installed with bower

 


0
Comment actions Permalink

Very well, now copy the underscore lib to another dir like root/lib/underscore.js and reference that in the config instead of from the bower_components we don't use our third party libs from their installation path. When WebStorm finds more than one implementation of a library is when it get's confused.

0
Comment actions Permalink

 if you have multiple instances of a library file in your project for some reason, and you believe that it's the problem, just exclude all files except for the one you work with. You can exclude the directory it resides in (mark directory as/excluded), or mark file as plain text, or add it to ignored files and folders

0
Comment actions Permalink

Well we have the bower_components and node_modules both dirs excluded, but we have a third party lib that has the underscore lib included in its source and it's a different version so we can't really change it. And BTW WebStorm finds the implementation in the bower_components and node_modules even if they are excluded and presents it as some of the multiple implementations for the lib. The version inside node_modules it's also a different version of it, used by some of our build process tools. Ideally it would great if WebSorm only tracks the one defined in the requireJS config or honor the library configuration either one should work.

0
Comment actions Permalink

>WebStorm finds the implementation in the bower_components and node_modules even if they are excluded and presents it as some of the multiple implementations for the lib

This means that these implementations are not excluded. For example, WebStorm automatically excludes node_modules folder, but adds all direct dependencies listed in package.json to javascript libraries, that are included and used for completion/navigation

0

Please sign in to leave a comment.