Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349845 - Provide support for common libraries such as dojo in javascript editor
Summary: Provide support for common libraries such as dojo in javascript editor
Status: RESOLVED WONTFIX
Alias: None
Product: Orion
Classification: ECD
Component: JS Tools (show other bugs)
Version: 0.2   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-20 11:51 EDT by Mike Fulton CLA
Modified: 2015-05-05 14:50 EDT (History)
4 users (show)

See Also:


Attachments
editor view when looking at 'clean' code that uses dojo (252.04 KB, image/png)
2011-06-20 11:53 EDT, Mike Fulton CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Fulton CLA 2011-06-20 11:51:01 EDT
With any luck, I am just using the editor wrong, but I have a simple javascript file that ends up with many, many errors in it when it is parsed because it doesn't know about the dojo entries that are 'required'. 

It would be nice if there was a way that I could specify other javascript files from a javascript file so that it could parse things correctly. I have lots of ideas - and happy to share them - but perhaps this is already on the 'being solved' list...

I will attach the source files shortly...
Comment 1 Mike Fulton CLA 2011-06-20 11:53:45 EDT
Created attachment 198264 [details]
editor view when looking at 'clean' code that uses dojo
Comment 2 Mark Macdonald CLA 2011-06-20 12:53:18 EDT
Add these 2 lines at the top of your file, and most of the errors should go away:

/*jslint browser:true*/
/*global dojo*/

Orion uses JSLint for JavaScript validation, and JSLint treats references to a global symbol as errors unless the symbol is declared explicitly. These 2 lines tell it to assume the "dojo" symbol along with common browser globals (document, Option, etc).
Comment 3 Wolfgang Glas CLA 2014-01-19 03:54:14 EST
Is there any progress on AMD-based toolkits like dojo?
Comment 4 Mark Macdonald CLA 2014-01-20 11:31:48 EST
(In reply to Wolfgang Glas from comment #3)
> Is there any progress on AMD-based toolkits like dojo?

We have nothing specifically for AMD yet. But we have made progress on some prerequisites: a JS validator that is easier to extend, and support for index files in the Tern.js format.

To deal with AMD, we'll likely also need a mechanism for users to provide their AMD loader config and their project->web path mapping. With those (and an index file providing the API type signatures), we should be able to extend the validator to statically check calls to library methods. This is unlikely to happen in the Orion 5.0 timeframe.
Comment 5 Wolfgang Glas CLA 2014-01-20 14:43:57 EST
Hi Mark,

  Thanks for your reply. Support for AMD-modules was one of my big hopes with browser-based IDEs, but so far I have disappointed by all of them.

  Hopefully, eclipse orion as one of the most fast-moving frameworks will finally get there ;-)

  Best Regards,

    Wolfgang
Comment 6 John Arthorne CLA 2015-05-05 14:50:47 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:

https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html