Webstorm IDE and AngularJS angular.module unresolved method - javascript

I am using Webstorm IDE for an AngularJS project.
I have added AngularJS to the librairies and autocompletion etc. works just fine.
However, Webstorm IDE does not find the function angular.module() which is quite central. I have tried everything (reinstalling, etc.) but it still does not seem to work.
Any ideas what it could be?

To date there has been no progress on the WebStorm IDS ticket referenced above by #AllYouCanEat86 so I am not sure if it should be fixed without adding libraries to WebStorm. Once I followed the advice given in this answer my issue was resolved and no longer got the warning in WebStorm.
In short go to File > Settings > Languages & Frameworks > JavaScript > Libraries and download angular (used to be called angularjs) from the community stubs. It appears in the list as angularjs-DefinitelyTyped once it has been downloaded.

I don't have the reputation to reply to a comment yet, but #Precastic's solution worked for me using Webstorm 9. Note that the library name is "angular", not "angularjs", however.
To be clear, that solution was:
In short go to File > Settings > Languages & Frameworks > JavaScript > Libraries and download angular from the community stubs. It appears in the list as angular-DefinitelyTyped once it has been downloaded.

I had the same problem, and the only solution was to include AngularJS using a CDN as instructed on the Jetbrains blog.
You include the script tag like this:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
And follow the instructions below:
If you prefer to use a CDN, place the cursor over the highlight library name, hit Alt+Enter, and Download Library. This will set up a local library in WebStorm’s cache (not in your project) so WebStorm can access AngularJS methods, directives, etc for autocompletion and documentation lookup.

Related

How to add AngularJS 2 in existing Java Web project

I have some experience using AngularJS 1.x in .Net MVC application. In that project, we basically downloaded all required Angularjs min files and included them in project. We did not use npm or bower. It worked fine.
Now my next project is on Java Web application. This is an existing application with plain servlet/jsp. I want to use Angularjs 2 on new pages that I'm developing. But I'm not able to make progress on how to include Angularjs in this existing project.
Angular team recommends to use Typescript along with npm/gulp. But I want to stick to javascript and not introduce complications with TypeScript in existing project. I was expecting to download angular min files and include in my JSP and get going. Apparently I cannot even find link do download min files. New Angular website doesn't even have link to download them. I also looked up angular github but couldn't find min files.
I would appreciate if someone can guide me in right direction. At this point, I'm thinking to stick to 1.x instead of 2.0. Thank you.
Wow, that is so annoying.
You could try creating a test project using NPM, add the dependencies you need, and then build the project. From there, you could copy paste out the javascript files you need.
Hope that helps.
You can find angular2 versions prior to release here : https://code.angularjs.org but if you want the latest ones you will have to try Samuel's answer.
Besides, if you're doing this project at school and it asks you to use servlet / jsp, you should stick with it and use something like bootstrap for easier html/css.
Doing the frontend with angular might be considered a cheat or a workaround ( speaking from experience )

NetBeans IDE no autocomplete due to JSX parsing error [duplicate]

I've just downloaded Netbeans 8.1 for PHP. Based on https://netbeans.org/bugzilla/show_bug.cgi?id=250288 , it appears that there is no native ReactJS/JSX support. Is anyone using this for react. Are there any workarounds? I'm been using Netbeans for years and would hate to have to move to a different IDE.
Well, i'm a Netbeans user too, but because of needs like this, i've switched myself from Netbeans to Sublime (first) and now to Atom for Frontend development and honestly, the workflow is great. I use ReactJS, AngularJS and VueJS, and for all of this Atom fits my needs.
Atom uses packages (like plugins) to support all of this, here's what i use for React:
Atom (https://atom.io/)
React Package (https://atom.io/packages/react)
The package adds:
Syntax highlighting
Snippets
Automatic indentation and folding
JSX Reformatting
HTML to JSX conversion
Autocomplete
Something important to remember is that sometimes Atom uses the wrong syntax highlight for some reason, so, in JSX files just click in the bottom right corner (next to the encoding) and you can select your filetype there (for ReactJS, should be Javascript(JSX)) and everything should be fine :)
I invite you to try it, its a great experience and for backend development (in my case, PHP) Netbeans is way better, from a lot of benefits that in frontend you might not need (the most to me is think is "Go to declaration", which in frontend i don't have/need).
If you want to know what other packages i use that might help you in frontend development just let me know and i'll update this post :)
Good luck!
Try this:
https://blogs.oracle.com/geertjan/entry/react_js_and_netbeans_ide1
It's still in early development but it should do the job.
Support for ReactJS is now included in Netbeans 8.2
source (last post):
https://netbeans.org/bugzilla/show_bug.cgi?id=250778
I personally don't find it satisfactory yet, which brought me to this question....

Should I put the version number of my JavaScript library in the file name?

I am about to release a javascript library.
I would like to save the file as [library-name].1.0.0
Then as the library will evolve you will be able to download new versions, e.g.
[library-name].1.0.1.js
[library-name].1.0.2.js
[library-name].1.0.3.js
[library-name].1.1.0.js
[library-name].1.2.0.js
[library-name].2.0.0.js
My question is: is there any reason not to save the version in the name of the file?
I am using other 3rd party libraries and the ones for which I don't store the version I always have to figure out if I have to upgrade or not.
For instance, I use codemirror.js, and I always wonder if I am using the latest version.
If you are giving it for download, then its a good idea to have version number as part of file name. Also its a good idea to add version number along with the license info at the beginning of the file like jQuery does
Checkout - http://code.jquery.com/jquery-1.9.1.min.js
Only case where you shouldn't add version number is when you are referencing a script file throughout your website - because you don't want to change all references whenever you update the script.
I've never released any libraries myself, but putting the version number in the file name sounds like a fine idea to me.
On upgrading, I think not putting the version number in the file name is used for libraries where the author doesn't expect to introduce breaking changes in future versions, only bug fixes and additions that don't affect code already written against the library. This means that people who use the library but don't host it themselves (i.e. who point to the library on a public CDN) automatically point to the latest version, and thus get bug fixes without having to do anything.
But, as you say, for people who download the library and host it themselves, it does mean they have to open the library file to check the version number.
If you want to match what some other library publishers do, you might want to have a look at Semantic Versioning - it codifies the x.x.x version numbering system.
And if you're going to release your library through Github (which I believe is what the cool kids do these days), you might want to use Jonathan "Wolf" Rentzsch's system for doing semantic versioning there.
If you are using unit tests you can make sure that the V1 unit tests all work fine against V2 before releasing the library.
Smashing article on js unit testing
If I understood your question correctly, one reason not to include the version name is that if you're hosting the script users using that CDN-hosted file don't have to change any code when you upgrade.

How to ignore certain javascript libraries with the Html5 template?

I just upgraded my NetBeans from 7.3 Beta 2 to 7.3 RC1. In Beta 2 I could only exclude full folders (with the php project type). To ignore specific files I edited the project.properties file. This greatly helped me to ignore multiple versions of included libraries.
In RC1 we have the Html5 project type. I no longer find any option to ignore files, and adding ignore.path to the project.properties no longer seem to do the trick for me.
So my question is, is there a way to ignore files with the Html 5 project type? If so, how?
If not, is my only way of solving this to move the library sources outside of my project and include only the debug-all-with-comments type files, or how would you go about solving this problem with overly many versions of my libraries being parsed?
A partial solution can a migration from HTML5 to PHP Project in Netbeans.
Rename nbproject folder to nbproject-html in your Project source files folder to store netbeans settings.
Create Php Project with Existing Sources in Netbeans.
Go to Project - Properties - Ignored Folders - Add your libraries.
Now code completion is much faster. Moreover I could also solve the problem of documenting tags catch-up with Ctrl + Space, as php is evidently better supported in Netbeans than HTML5.
In our case it was netbeans 8 and pure javascript enterprise project based on ExtJS.

How do you attach JSdoc in Eclipse so that I can have autocomplete for a personal library

I have a JavaScript library that I am working on currently. I have structured it into lots of files and I use the module approach to define each 'module'.
var ns = generateNamespace("me.mycompany.mypackage.MyFile");
(function (ns, undefined) {
// some module
}(ns));
The modules are dynamically named using a namespacing function meaning that autocomplete is almost impossible as things stand (unless Eclipse can run my code and figure out the namespaces, Visual Studio can!).
Therefore I intend to generate JSdoc for my project in the hope that if I include this into Eclipse (somehow) Eclipse can use this to give me content assist.
Firstly I do not know if this is possible... however I think that it is as I can see that it is maybe how this works? However I tried to follow this along and struggled to get something working, by this I mean it didn't work. The interesting info from the link:
"JSDT libraries are collections of JavaScript source files that have prototyped object/class definitions and JSDoc. The inference engine then models these libraries... making them available to every JavaScript file in the project... Bindings for nonstandard and future runtimes are similarly easy to create... add the... library to their project and gain content completion and hover help"
I know how to write JSdoc annotations and I know how to generate JSdoc using one of the various tools.
What I need therefore is instructions on how to include JSdoc (as a library maybe) in Eclipse so that it will give auto complete for the stuff in the JSdoc.
Previous answer:
You can also run jsdoc_toolkit from within eclipse by setting up Run -
> External Tools -> Open External Tools Dialog...
Location
C:\Program Files\Java\jre1.5.0_12\bin\java.exe
Working Directory
C:\DirectoryToWhereJsDocToolkitIsLocated\jsdoc_toolkit
Arguments
-jar app/js.jar app/run.js -r=4 -t=templates/htm "-d=C:
\PathToWhereDocIsSaved" "C:\PathToWebsiteToDocument"
For more about the arguments check the jsdoc_toolkit documentation.
Have fun
Simon
Taken from this Google Groups thread.
Updated Answer:
Eclipse JavaScript Editor: content assist for js files, autocompletion
Disclaimer, I'm the author of tern.java.
I suggest you that you install tern.java. It provides a JSDoc support. Once you have selected this support, you can benefit
with completion :
and soon with validation:
This support is not perfect but it starts working.
I am not using it by myself, so I'm not sure if it works, but there exists a grunt-plugin for jsdoc3. Grunt is supported by Eclipse. So maybe it helps.
Grunt-PlugIn in npm

Categories

Resources