Nodeclipse / nodeclipse

Nodeclipse-1 : Eclipse plugin for Node.js, PhantomJS development (Nodeclipse core plugin); Maven and Gradle (with Android) plugins
https://nodeclipse.github.io/
158 stars 76 forks source link

adding custom JavaScript library to JSDT #90

Open paulvi opened 11 years ago

paulvi commented 11 years ago
  1. adding custom JavaScript library to JSDT http://www.eclipse.org/forums/index.php/t/166649/

To programmatically add a JS library to a project: private void addJSLibToProj(IProject proj) { IJavaScriptProject jsProj = JavaScriptCore.create(proj);

    try {
        IIncludePathEntry entries[] = jsProj.getRawIncludepath();

        // an impl of IJsGlobalScopeContainerInitializer
        LibInitializer jsLib = new LibInitializer();

        // LibInitializer.getPath actually returns the LibraryID defined in the plugin.xml
        // wrapped in a Path object.  Funky, but okay.  
        IPath ourLibPath = jsLib.getPath();
        IIncludePathEntry ourEntry = JavaScriptCore.newContainerEntry(ourLibPath);

        IIncludePathEntry newEntries[] = new IIncludePathEntry[entries.length + 1];
        System.arraycopy(entries, 0, newEntries, 0, entries.length);
        newEntries[entries.length]= ourEntry; 

        jsProj.setRawIncludepath(newEntries, true, null);
    } catch (JavaScriptModelException e) {
        LogError( e );
    }
}
  1. Add External JS Libraries to Eclipse JSDT-driven Projects http://www.htmlgoodies.com/html5/javascript/add-external-js-libraries-to-eclipse-jsdt-driven-projects.html
paulvi commented 11 years ago

However even added Node.js library would created problem because client and server side would be mixed:

http://www.eclipse.org/forums/index.php/t/590420/ by Pavel Sosin

In our environment JavaScript is used for both client side and server side development. To distinguish between client side and server-side JavaScript the new "server side" content types (file extension) are defined via JSDT extension point org.eclipse.wst.jsdt.core.jsSource. It caused the problem of cross content type visibility in code completion: variables and functions are visible regardless the file type. The same problem exists also for Libraries: content of Client side and Server side libraries is always visible when either client side or server side script is edited. Is it possible to separate visibility of JavaScript artifacts for CodeCompletionRobot according the Project Path using, for example, org.eclipse.wst.jsdt.core.sourcePathProvider extension point?

paulvi commented 11 years ago

getting started with adding custom library support to JSDT http://www.eclipse.org/forums/index.php/t/206427/ started by Philippe Marschall (JSDT jQuery author)

paulvi commented 11 years ago

jsdt-add-javascript-library

paulvi commented 10 years ago

If adding User Library, as JSDT doesn't not support CommonJS modules, modules are exposed entirely, creating mess (as they form one namespace).