Netbeans doesn't support javascript - javascript

I had netbeans 6.9, and i was trying to edit javascript on it. However, I keep getting code errors in my .js files. I can't even create a new javascript template. I tried upgrading to netbeans 7.01, but this doesn't change. I also enabled the JAVA plugin, but it doesn't help.
Anyone know what's going on?

I get a bunch of errors where it says "unclosed character literal" or
"character, interface, or enum expected"
I suspect you've somehow configured NetBeans to handle *.js files as Java, which is an entirely different language.
Go to Tools-> Options-> Miscellaneous-> Files and find js in the "File Extension" combo. The "Associated File Type (MIME)" input box should say text/javascript.

the java-plugin is for java, so this won't help you.
what you'll need is to activate javascript-support. javascript is included in the PHP-pack (and also available as plugin).
to install the plugin, simply click tools -> plugins and install PHP to enable javascript-(and html-)support.

Related

Debug JavaScript in IntelliJ IDEA

How can I debug JavaScript for my website in IntelliJ IDEA without changing my build configuration?
I am able to debug the JavaScript in Chrome Console but it does not work very well.
Answer. It is really easy:
Create a new JavaScript Debug Run configuration and specify the WAMP address you normally use to open your application in browser as URL there. See https://www.jetbrains.com/help/webstorm/2017.2/debugging-javascript-in-chrome.html#d45520e154 and linked topics.
You might also need to configure URL mappings in your configuration - https://www.jetbrains.com/help/webstorm/2017.2/debugging-javascript-deployed-to-a-remote-server.html#d46122e202
First you need to add intellij plugin for chrom and install it on chrom, then on configuration debug
you need to choose run with javascript.
I can show you screenshot if you want
It is worth noting that you should have linked separate .js files for debugging. I was trying to debug JavaScript code which was within an .html file but the breakpoints were never hit. I looked later under the resources in Chrome Inspector and found out that the lines were not synchronized between the files, because for the debugger the first line was the first JavaScript line, but for the html file it was the first line of the file (DOCTYPE)

Eclipse Neon Content Assist has no proposals for JavaScript

Bottom Line Up Front: Eclipse Neon content assist (Ctrl+space) does not offer any proposals for my JavaScript code.
Here is what I've checked so far:
JSDT has been installed
"JavaScript resources" include ECMASciptBuilt-In Library, ECMA 3 Browser Support Library, jQuery
The project's Include path has ECMAScipt Built-In Library, ECMA 3 Browser Support Library, jQuery, and JavaScript Web Project support
Eclipse's JavaScript Content Assist is enabled and includes Basic proposals, Other JavaScript Proposals, Template Proposals, and word proposals.
I changed the content assist from ctrl+space to ctrl+0 to check whether ctrl+space had been hijacked
Content assist DOES work with regular Java (in a different project)
I tried reset to defaults under Content Assist > Advanced
JavaScript facet is selected for the project
.js files and .jsp files are stored in folders that are under folders that are designated as source folders in the project properties under JavaScript > Include Path
This is also an issue in Mars 2.
I've run through the steps listed here for configuring content assist: http://www.eclipse.org/pdt/help/html/using_javascript_content_assist.htm
The content assist isn't even proposing functions that are defined within the same .js file. How can I get Eclipse's content assist to propose elements correctly?
I have the same problem and it seems to be a known bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=504057
+1 not working in Eclipse Neon. As an alternative you may try Netbeans 8. Javascript is working good there. I don't know what happened to Eclipse but php and Js support is poor.
P.S. Just downloaded Eclipse Mars - can confirm that it's working fine.
I've met this situation before,and then I found that if the js file is in a "normal java project",then it won't come uip with content assist,but if the js file is in a "dynamic web project",then the content assist just work well,hope it will help.

IntelliJ Community Edition: Javascript syntax highlighting

I'm using IntelliJ IDEA 12 Community Edition, and am trying to set the syntax coloring for Javascript files. When I choose File > Settings > IDE Settings > Editor > Colors & Fonts, Javascript is not an option in the list. Is this a limitation of the Community Edition IDE, or am I missing something? The others I need are listed, like Java and HTML, but Javascript is missing from the list.
Thanks.
JavaScript support is supported in Ultimate Edition, but not in Community Edition.
For the basic syntax highlighting you can try the TextMate Bundles Support plug-in. See this document for the setup instructions (it's for PhpStorm, but instructions for IntelliJ IDEA would be the same).
The TextMate Bundles Support plug-in is not enough. You also need specific language bundles.
install and enabled the TextMate bundle support plugin in IntelliJ
Download the specific language bundles and unzip them somewhere where you find them, e.g., TypeScript, Shell Script TextMate Bundle
Open the Settings/Preferences dialog, got to Editor and select TextMate Bundles
Click on the + on the right side and choose the desired bundle from 2. on your hard disk. Then it should appear in the list of recognized bundles.
Extension conflicts might appear: Click on "Show details". If you want to use the new syntax highlighting click on "unregister native file type".
A detailed explanation with screenshots can be found here
I found this question after searching by "how to enable JS syntax highlight into JSP files" in my Intellij Community Edition.
Following the suggestion to use TextMate Bundles, I checked that it's already installed by default, including JSP support (built-in). But it did not work.
So, I fixed it by just removing the "*.jsp" pattern from "File Types > JSP", and after that now my IDE is using TextMate syntax highlight properly.
Use Visual Studio Code for Javascript support when using IntelliJ Community Edition. It's free and has all the support you would get for the paid version of IntelliJ Ultimate.
Or buy it for $149 (personal ultimate edition). I've been buying it since 2013 and find it far superior to XCode. This is just my personal opinion though. Download a trial and see how you like it!
Pricing:
https://www.jetbrains.com/idea/buy/#personal?billing=yearly
Trial:
https://www.jetbrains.com/idea/download/
ps: I'm not endorsed or affiliated with Jetbrains. Just a fan.
Alternative I tried (but raised another issue):
Marked VS Code as default app to open .js files.
For IntelliJ, follow this: to configure .js files should be opened using VS Code
This has enabled to opening .js files into VS code when we command from IntelliJ Idea, but strangely, .js got disappeared from "Find in files" search list.
Inputs are welcomed, whether I had configured it wrong.

Good code highlighting, syntax analysis and code assist editor on js.erb and css.erb files

I want to know if there is an api that supports nicely eRuby (erb) and JavaScript highlighting, sintax analysis and code assist.
I've already tried Eclipse with Aptana RadRails.
Perhaps I'm configuring something wrong, but it guesses that I'm using html.erb on both css.erb and js.erb files. Tried in both windows and linux (Fedora 12).
I've tried too the Emacs with nXhtml, MuMaMo, js2 and Rinari modes. Again, it works fine for html.erb, but it detects the css.erb and js.erb as html.erb files. Maybe it's possible to configure it to accept that files and be compatible. Tried in both windows and linux (Fedora 12).
Also, doesn't matter the operative system, just getting the code analysis, assist and highlighting I'm happy with it.
Normally Emacs decide what major mode (multi major with nXhtml) to use from the file extension. It can however use the whole file name path or the contents too.
If you send a bug report for nXhtml we can try to work it out.
A simple solution is to use indirect buffers :
On a buffer with multiple languages, do a C-x 4 c
It shows the same buffer in another window. Each window can have its own major mode. You could have one window in ruby mode, one another with java-mode for your javascript, etc.
Behind all those windows is one single buffer.
For syntax analysis, you should use flymake, but it requires you to configure it properly for eRuby.

Adding additional js files breaks jQuery IntelliSense

I have been using jQuery IntelliSense in VS2008 and it has been great. Recently I added a reference to jQuery UI and since then, the jQuery IntelliSense has went away. I found that once you reference another .js file in your document, the IntelliSense goes away. Any way to avoid this?
If there are errors in any refernced files it will break intellisense for all files references from the same document. The next version of Visual Studio is going to be much more robust in this respect. I apologize directly for this fragility. We made some design decisions early on that we prevented us from making VS9 external references more robust.
In the meantime, use the following workaround. Install SP1 from the link Slace gave you. If you have a reference a file named .js and there is a file named -vsdoc.js in the same location, then JS intellisense will pick up the -vsdoc version. If that script is empty then it won't generate an error. Identify the jquery plugin that is causing intellisense generation to fail and place a -vsdoc version next to it. You won't get intellisense for UI, but you will still get jquery and other plugins that do work.
Anything you put in the vsdoc version will show up in intellisense. You could put spoofed versions of the data structures that you want to display in intellisense if you want to.
It's likely that there's a bug in one of the subsiquiently referenced JavaScript files. Open your JS file and once the "Updaing JavaScript Intellisense" has gone from the status bar of Visual Studio (there is a menu option which will force the JS intellisense to refresh, don't remember where it is, I just created a keyboard shortcut via the Tools -> Options -> Keyboard area) open up your Errors window and under the Warnings you should find the reason why the intellisense has failed to load.
It's generally a bug found when parsing one of the files but I have had stack overflows when I had a lot of files referenced.
Edit: You also should make sure you have this VS patch installed: http://code.msdn.microsoft.com/KB958502 and VS 2008 SP1 (install SP1 first!). Then you just need to have:
/// <reference path="/path/to/jquery-1.3.1.js" />
Ensure that you maintain the -vsdocs on the intellisense file and it will be automatically picked up (as long as it's in the same folder as the file you reference)
The accepted answer helped me fix this issue but didn't resolve the problem. I installed the hotfix: http://code.msdn.microsoft.com/KB958502 but was still receiving an error.
Error:
Error updating JScript IntelliSense: D:\Dev\Test\Scripts\jQuery-1.3.2-vsdoc.js: 'jQuery.support.htmlSerialize' is null or not an object # 1430:4
It appears the addition of the follwing file without the appropriate -vsdoc.js file causes the above issue.
<script src="../../Scripts/jquery-ui-1.7.custom.min.js" type="text/javascript"></script>
I added an empty file "jquery-ui-1.7.custom.min-vsdoc.js" to my scripts folder and the Jscript Intellisense issue went away.
I'd like to present a slightly better solution. A few months ago I tackled this problem and created a very basic vsdoc file for jQuery UI. Here's the link to the blog post (which has the file for download).
I solved this per the advice above with a minor extension: the trick for me was to add a reference on my page to both my jqueryui.com library AND to the blank -vsdoc.js version of the file I created:
<script type="text/javascript" src="../../Scripts/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="../../Scripts/jquery-ui-1.7.2.custom.min-vsdoc.js"></script>
Hope this helps!
Great, the tweak is by creating an empty *-vsdoc.js file for each troublesome *.js files.
I found this error caused by anonymous function e.g. like this:
(function($) {
$.anything...;
})(jQuery);
Hope this caused will help somebody creating the http://code.msdn.microsoft.com/KB958502 and JScript IntelliSense Team.

Categories