javascript code formatting in eclipse doesn't work - javascript

javascript code formatting doesn't work at all in eclipse under xubuntu.
Same problems with auto-completion and with validation.
I tried different way to install Eclipse and its different plugins nodeclipse, tern, jsdt ...
I tried to open file with different editors.
I tried to change formatting profile.
But everywere everything just doesn't work.
It perfectly works for C/C++. But javascript not. It look like something generally wrong with my eclipse+javascript+node.js environment. But what?

Did you try JSDT pluging?
https://eclipse.org/webtools/jsdt/
It adds a JavaScript project type and perspective to the Eclipse Workbench as well as a number of views, editors, wizards, and builders.

The Eclipse "JavaScript Editor" (from JSDT) always had some issues.
Formatting does work, but can break under some circumstances.
The JavaScript-Plugin in Eclipse is buggy and evil since a few years.
Quota from: Auto-formatting of JavaScript code in Eclipse
This is not just my opinion, this has been going on for years as the Eclipse community had a hard time catching up with the Java/JavaEE evolutions (and C/C++ and ...) in parallel to all the JavaScript changes.
I do not blame them as this is all for free !
The Eclipse JavaScript Editor (JSDT one) can 'choke' on various keywords for example: myObject.import(xyz); will break it (on some versions at least) due to the import keyword.
Sometimes I also noticed that some types of calculations involving divisions and many brackets broke the formatter. Autocompletion also has many issues, support is far from that of Java or C/C++.
It can also get slow due to code folding, but that can be disabled in Editor/Folding and spell checking which can also be disabled.
Eclipse Wild Web Developer
With the latest Eclipse releases since 2019 / 2020 you can use Eclipse Wild Web Developer (Red Hat is the main contributor):
Info
Install or here Github
Background:
Because of technical reasons (reimplementation of parsers mostly) and
strategical priorities (Java EE), Eclipse IDE and the WebTools project
have hard time catching up with innovation in the front-end Web
development world. As a result, several editors for typical web
languages (CSS, HTML, JavaScript...) shipped in the Simultaneous
Release are of low quality compared to the state of the domain and
competiting IDEs.
Yes we noticed ^^
Eclipse Wild Web Developer integrates existing artifacts like TextMate
grammars and Language Servers to provide a rich development experience
to Web developers using typical programming languages for the Web
(CSS, HTML, JSon, JavaScript, TypeScript...).
Eclipse Wild Web Developer is about integrating existing technologies
for those languages more than creating more specific language
smartness.
That is a wise decision.
This reminds me of Unity vs Gnome in Ubuntu ... or various browsers ending up using Chromium. Maintaining your own stuff and keeping the pace is hard.

Related

Correctly configuring Eclipse for non-web JavaScript development

Recently I've needed to write a small utility for Acrobat in its JavaScript.
Because the editor in Acrobat is pretty limited, I've installed the latest release of Eclipse IDE for JavaScript and Web Developers (Neon). It should already include the latest JSDT 2.0.
However, I've been surprised, that Eclipse's JavaScript editor does not correctly parse even simple common JavaScript patterns, like namespaces, modules, single global variable, etc. Also code folding is missing, except the very first function.
I do not expect to debug Acrobat's JavaScript code in Eclipse, but I wanted to have a smart JavaScript editor and also projects, where I could gather a few non-JavaScript resources. Some automation possibilities would be also nice, of course.
I've played with Eclipse preferences a lot and I've also searched on Internet, but I was not able to find anything really helpful.
Have I missed something in Eclipse configuration or is it really wasting of time and I should use something else?
For small projects a free IDE would be preferable, but also reasonably priced commercial products would be acceptable.
A configuration solution in Eclipse would be the most welcome, of course.
Thanks a lot for your help.
The support for newer Javascript Syntax is very bad in Eclipse (Bug).
You can use Tern.js it has a good ES5 and ES6 support.
But for Javascript development there are a lot of much better editors like Webstorm, VisualStudio, Sublime out there. You'll like more!
From my experience with Acrobat JavaScript, and the Acroforms technology (which you use when you work in PDF), there are not that many advantages you get from an IDE.
In fact, for my work (which IS extensive), a good text editor, with quote and parentheses balancing, maybe even auto-indent, and basic JavaScript code coloring is pretty much sufficient. I personally do write the scripts in BBEdit, and then copy/paste them into the Acrobat JavaScript editor window.
Keep in mind that JavaScripts in Acrobat/PDF are generally quite short, because they do not have to deal with DOM overhead, and because the field event sequence is quite structured (and it is really important to understand this sequence… more important than fancy JavaScript constructs). You also have to be aware that the JavaScript core implementation in Acrobat is relatively old (recently, they did upgrade it, but if your forms/applications are for the general public, you can't rely on them having the very newest version of Acrobat/Reader).

Javascript plugin for Eclipse?

I am very happy with Eclipse and don't want to change my IDE, but find the pre-bundled Eclipse plugin for JavaScript too difficult to work with.
Too many of the features that I got used to developing Java (not JavaScript) in Eclipse seem to be missing or incomplete, such as an intelligent code analysis, smart refactorings, a truly language-related (not full-text) reference search, class inheritance trees, etc.
Any suggestions for alternative Eclipse plugins for JavaScript development?
Admittedly, it is a lot more difficult to analyze JavaScript code (compared to Java) not only for a plugin but also for any human programmer, because JavaScript comes with fewer structural elements, and because there are so many different ways to do common things like inheritance or modularization. But there's got to be something, right?
As Nodeclipse lead, I am always looking for what is available in Eclipse ecosystem.
JavaScript support is Eclipse JSDT project.
It gives Editor, and JSDoc support.
For ES5 support, JSDT validation is to be disabled and JSHint-Eclipse used.
Also there is new Tern-IDE plugins, that gives hints and go to definition by using Tern.js.
The same author leads AngularJS plugin
All mention plugins can be got via Enide Studio 2014 (installed as plugins or downloaded as stand-alone product).
Nodeclipse site has even more links,
and I am inviting to collaborate on the JavaScript tools on GitHub
There are also JSON Editor and Json Tools.
Unfortunately VJET is no longer continued as there is no backing company now.
All effort are community driven. The simplest contribution is reporting bug or taking own issue to research and share.
Any suggestions for alternative Eclipse plugins for JavaScript development?
No alternative plugins, just get more of them.
The VJET plugin seems to provide better JavaScript support, although I haven't tested it very extensively.
http://eclipse.org/vjet/
For necessary code hygiene I recommend to use JSHint (a sane version of JSLint).
http://marketplace.eclipse.org/content/jshint-eclipse
Both are installable through the built-in Eclipse Marketplace.
The popular Aptana IDE, which is based on Eclipse, is also available as plugin, but I haven't tested it as plugin.
http://www.aptana.com/products/studio3/download
My personal opinion: Eclipse has outdated syntax validators (no ECMAScript 5 support) and non of the plugins can fix that. The problem is known for years (Bug Report), but nothing is done about it. Code completion seems to be a lot better in the WebStorm IDE or Sublime Text with certain plugins. Right now, I'm quite happy using Eclipse for my backend Java stuff and WebStorm for the frontend code for the same project.
A. In the Eclipse world...in my opinion... the best JavaScript support is currently given by Eclipse Orion, a web based variant of Eclipse:
https://orionhub.org
Orion applies tern.js to get JavaScript features like highlighting and completion:
Eclipse orion code completion
The JavaScript library tern.js seems to be up to date:
https://github.com/ternjs/tern
And it is applied by several Source Code Editor plugins:
https://ternjs.net/#plugins
B. On the other hand, all JavaScript plugins for Eclipse seem to be outdated.
See for example
http://www.eclipse.org/webtools/development/news/main.php (last updated 2016)
The Eclipse Plugin for tern.js seems to be out of date, too:
https://marketplace.eclipse.org/content/tern-eclipse-ide
I was not able to install it on the current Eclipse version Photon.
Also see https://github.com/angelozerr/tern.java/issues/463
C. If you are open for a commercial JavaScript editor, try to use WebStorm, als already suggested by Tilman.
If there is a good Eclipse based JavaScript solution, that I am not aware of and that is able to compete with the features of WebStorm, please let me know.

Developing Windows apps with JavaScript

I'm currently in the need of developing a Windows application. I want to keep things simple (in the spirit of uTorrent) and I would like the result program to be a single .exe file containing all that it needs.
The program is simple. It just needs some UI. It needs to run for a long period of time (lay there as a tray icon). It needs to do some routine tasks like simple I/O. It also needs to access the internet, specifically some web server.
Apart from these small requirements I would like to write all of it in JavaScript, as I feel more comfortable with it than any other language.
I know there's things like Windows Script Host that let you run JavaScript programs and interact with some Win32 API, but will I be able to do everything I need with Windows Script Host? Can I pack all of the Windows Script Host in a single .exe?
If not, what alternatives do I have for JavaScript?
I found that there's actually a JavaScript compiler that comes with the .NET framework called jsc.exe.
For more information:
http://www.phpied.com/make-your-javascript-a-windows-exe/
http://msdn.microsoft.com/en-us/library/7435xtz6(VS.80).aspx
I guess it's not really JavaScript since it introduces extra things like import and even some class syntax which is weird for me. But this works perfectly for me as I will just doing things as I am used to on the web.
Aside from Windows Script Host, there are
Windows Desktop Gadgets (Vista and Windows 7 only)
HTML Applications (HTAs)
Both are written with standard web technologies, HTML, JavaScript, Flash, etc. They can also be extended with COM objects/ActiveX controls such as FileSystemObject, WMI, WScript or even ones that you write yourself. Windows Desktop Gadgets have access to a separate API/namespace with various Win32-esque properties and methods.
It seems that nobody mentioned JSDB.
JSDB offers a command line environment which you can execute arbitrary javascript code. You can easily compile to a .exe file by using the command copy /b jsdb.exe+program.zip program.exe
It's important to know that you've got to call your main js file main.js within a standard zip file. Not sure if the name program.zip is required.
I haven't actually tried making GUI applications with this yet - although it seems to support various APIs like ActiveX.
It's possible that by using the copy /b command mentioned above, you could compile a script from the wscript.exe file - but I tried and couldn't get it working. Let me know if anybody tries and has success somehow.
I think you're looking for Adobe AIR
The Adobe® AIR® 2 runtime enables developers to use HTML, JavaScript, Adobe Flash® software, and ActionScript® to build web applications that run as standalone client applications without the constraints of a browser. ~ The AIR website
Internet Explorer introduced the concept of Hypertext Applications in IE 5. It never made a big breakthrough, so resources and documentation are scarce.
Mozilla-backed competitor Prism seems to be alive and well, though, and is definitely worth a look.
Prism is an application that lets users split web applications
out of their browser and run them directly on their desktop
I believe the best way to go is V8 JavaScript Engine provided by Google.
"V8 can run standalone, or can be embedded into any C++ application." - which I believe is perfect for your needs, because you can do most of the stuff in JavaScript and use provided interfaces to communicate with the system.
I'm not 100% but I believe WSH uses JScript or WScript, not JavaScript.
Color me crazy, but its only a short step form Javascript to Java or C#. I'd suggest C# as, on a windows machine, the libraries are already there. You can just copypaste your .exe and let 'er rip.
If you want a single .EXE, what runtimes are you okay if they are required pre-requisites?
If you're okay with requiring .NET runtime to be preinstalled, then you do all your work in JScript.NET
Chromium Embedded Framework (CEF) may give you some help. i have not clearly know how, but i realy found many Apps using this framework.
http://code.google.com/p/chromiumembedded/
Introduce for CEF are:
The Chromium Embedded Framework (CEF) is an open source project founded by Marshall Greenblatt in 2008 to develop a Web browser control based on the Google Chromium project. CEF currently supports a range of programming languages and operating systems and can be easily integrated into both new and existing applications. It was designed from the ground up with both performance and ease of use in mind. The base framework includes C and C++ programming interfaces exposed via native libraries that insulate the host application from Chromium and WebKit implementation details. It provides close integration between the browser control and the host application including support for custom plugins, protocols, JavaScript objects and JavaScript extensions. The host application can optionally control resource loading, navigation, context menus, printing and more, while taking advantage of the same performance and HTML5 technologies available in the Google Chrome Web browser.
Numerous individuals and organizations contribute time and resources to support CEF development, but more involvement from the community is always welcome. This includes support for both the core CEF project and external projects that integrate CEF with additional programming languages and frameworks (see the "External Projects" section below).
Why not use Rhino -- JavaScript on the JVM? You can even compile your scripts to .class files and package them into a JAR along with Rhino for easy distribution...

IDE for JavaScript development [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
What do you suggest for JS development IDE. Is there something similar to VisualStudio IDE, so I can run/debug my application in it?
At JetBrains we've just developed lightweight HTML/Javascript/CSS IDE WebStorm that includes very smart JavaScript Editor with DOM-based autocompletion and HTML5 API support.
It allows you to debug(breakpoints supported) and run your scripts directly from IDE.
A few options:
Visual Studio 2008 (including VWD Express, http://blog.berniesumption.com/software/how-to-debug-javascript-in-internet-explorer/)
Adobe Dreamweaver CS4
Notepad++ (or any other text editor), Firefox and Firebug
I think IntellJ's JavaScript support is excellent, just like everything else that they do.
Netbeans 6.x and Firefox+Firebug
In the past I used Aptana Standalone or as a Eclipse plugin. The Pro version has some nice addons like the embedded IE (to the always embedded Firefox) and debugging support for both browsers.
I found after hours of testing, that Suns Netbeans is the best PHP and Python IDE for Windows and Linux. I was surprised that also Javascript support can hold the candle to Aptana.
So Netbeans is my recommendation (not only for Javascript).
Give it a try, its free!
I've found Aptana Studio to be good.
I tend to recommend more and more Netbeans that has not been proposed yet (I am blind sometimes). Netbeans is developed by Sun and support not only Java but also a few other languages (PHP,Ruby,Python, Javascript).
I use it for a while now and I am very satisfied. It is fast, provides code completion and integrates easily major JS libraries (Prototype, YUI). It has also a debugger that you can tied to FF or IE.
Try it you won't be disappointed!
Here's a good list of IDEs you can use for writing JavaScript:
http://www.programmerfish.com/top-8-ide-integrated-development-environment-for-java-script-html5-ajax/
Nowadays I am using JetBrains' PHPStorm and I can easily say, this is the best editor I've ever tried. Comes with lots of features that I have not seen at other editors like,
find a word in a directory (grep equivalent)
extended and useful intellisense feature with multiple files and parent classes
internal GIT support
a tree view for application structure
an awesome version history support that works with GIT and your local history. This is very useful when you want to take a look at a GIT untracked file, you can see all history details of the file for weeks.
with a great addon named CSSXFire that works with Firebug and tracks the CSS changes and import them to editor and allows you easily reproduce the same changes that you've done in Firebug CSS Console. This is really awesome
another useful feature is, when you want to delete or rename a file, editor searches the file has been used in this directory and notifies you. This is called safe-refactor
intellisense for files, while you typing a css background-image, a src or an href attribute
Sometimes I deal with PHP so I prefer PHPStorm, so Front End Developers should prefer WebStrorm that is specialized for us.
I think, every FE Developer should try PHPStorm or WebStorm with Firefox and Firebug.
Komodo IDE (or the free Komodo Edit if you can live without an integrated debugger) are pretty nice.
I tried few IDE last week and NetBeans is my winner. It got silent upload option for file upload in background. And very good code completion, folding, etc.
Here is my experience with the applications based on Extjs in UI with Java as server side language. I am a big supporter of open source technologies/products.
I so far I have used Eclipse, Netbeans, Webstorm and notepad++ with some added plugins.
And I feel Netbeans is best in terms of Syntax highlighting and formating. It recognizes missing commas, global variables, duplicate keys for object literals in a very impressive way.
Almost similar things can be achieved by adding some pligins like Spket in eclipse too, but it asks for licence when you go for advance level of settings.
If you are not so much concern about an integrated environment with web server then Web storm is best in all the aspects, but the biggest drawback of it is, "Its paid". ( Even if it asks for 1000 Rs ).
Firebug and a good syntax highlighting text editor is about the best combo. It's not necessary to add in much else. With just this combo you get:
Ability to set breakpoints
Inspect objects
Traverse the DOM
Alter CSS rules on the fly
See network traffic/responses
Evaluate and substitute code on the fly in production
And there are tools which add on to Firebug:
YSlow - Determine "why" your page is slow
Fireunit - Run unit tests
One of the advantage of Javascript development is that it's flexible and you can get instantaneous feedback while developing. I see no reason to get in the way of that by adding an IDE which includes a "deployment" step.
Notepad++ comes with built-in javascript syntax highlighting and JSlint plugin is very handy. IMHO for debugging there is nothing better than Chrome developer tools or Firebug.
This page reviews the most advanced Javascript IDEs (in terms of refactoring and intellisense anyway) :
http://blue-walrus.com/2013/08/review-javascript-ides/
Eclipse and JSEclipse plugin and of course Firefox + Firebug the ultimate duo. You'll find this development setup satisfactory.
Aptana is a great IDE as it will provide intelli-sense for CSS, javascript, html, java, etc. The debugger gives you the choice to run in FF or IE and is a full featured debugger. The community edition allows you to run a server side javascript as well. A very solid and feature rich platform for free.

I want to write a desktop OSX or Windows app in Javascript -- any experiences?

I'd like to write some small applications for Windows and OSX.
Portable is good. For instance, the simple TclKit solution for TCL would work well if I could stand to look at Tcl for any length of time.
I'm considering using Javascript + extensions -- I really like Javascript -- seems to me there should be some way to connect a Javascript engine to WxWin or even the Tk toolset -- it's been done for Perl, Python, Ruby, etc. Why not JS?
Any comments appreciated.
I would rather recommend using Adobe Air execution container, it offers way more capabilities / OS integration features compared to HTA of Microsoft or even XULRunner of Mozilla.
If you want to write a desktop app in Javascript, check out HTA: http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx
Here is an example of an app that I wrote a long time ago in HTA: http://www.boltbait.com/htmleditor/
Hope this helps.
If you have experience with HTML+JS web applications, I'd recommend Mozilla XULRunner. It gives you native-looking interface widgets (every piece of Firefox interface is a XUL element), and a workflow similar to building HTML-based interface.
You define the interface using XUL, an XML-based language, so it's almost like writing HTML, minus browser incompatibilities and CSS (you can use CSS, but only if you want). All application logic can be written in JavaScript, but in XULRunner you can do a lot more in JS than in a browser (read/write files, execute system commands, make cross-domain XMLHTTPRequests, and a lot of other stuff).
More: http://xulplanet.com/
A lot of example applications: http://code.google.com/p/xulapps/
Mac OS X users tend to dislike applications that don't follow usability guidelines of the platform (menu must be at top of the screen, standard shortcuts & drag'n'drop must work, "OK" must be at right-hand side of alertboxes, no "Apply" button in prefs and so on).
With one-size-fits-all toolkit this may be very difficult to achieve.
The good news is that there's JavaScript<>Cocoa bridge that can be used to create stand-alone full-featured Mac OS X application in JS – just keep front-end and back-end of your application separate enough to be able to plug different UI for each OS.
Rhino would probably give you access to swing. Though, I don't know how much work would be involved.
On the other hand, building a swing app with JRuby is so easy even a sock puppet can do it, so it shouldn't be too hard.
Definitely if you want to implement it using JavaScript, Adobe Air is the way to go. You will even have support on Linux.
Give Titanium Appceletaror a look: http://www.appcelerator.com/.

Categories

Resources