Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 260016 Details for
Bug 488530
[cross file linting] Ordering problem (must click on calling html file to get rid of errors even when tern file present)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
another patch
updated-addfile-fix.patch (text/plain), 12.85 KB, created by
Michael Rennie
on 2016-03-01 13:22:59 EST
(
hide
)
Description:
another patch
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2016-03-01 13:22:59 EST
Size:
12.85 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/api/ternServer.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/api/ternServer.js >index 8fefc6c..6e62e6e 100644 >--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/api/ternServer.js >+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/api/ternServer.js >@@ -1,6 +1,6 @@ > /******************************************************************************* > * @license >- * Copyright (c) 2015 IBM Corporation and others. >+ * Copyright (c) 2015, 2016 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials are made > * available under the terms of the Eclipse Public License v1.0 > * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution >@@ -527,6 +527,9 @@ > defNames = jsonOptions.defs; > ddir = jsonOptions.defsDir; > } >+ if(Array.isArray(jsonOptions.loadEagerly) && jsonOptions.loadEagerly.length > 0) { >+ options.loadEagerly = jsonOptions.loadEagerly; >+ } > if (typeof jsonOptions.ecmaVersion === 'number'){ > options.ecmaVersion = jsonOptions.ecmaVersion; > } >@@ -534,10 +537,18 @@ > options.dependencyBudget = jsonOptions.dependencyBudget; > } > } >+ function _loadFiles(ternserver, options) { >+ if(Array.isArray(options.loadEagerly)) { >+ options.loadEagerly.forEach(function(file) { >+ ternserver.addFile(file); >+ }); >+ } >+ } > function defaultStartUp(err) { > options.plugins = plugins; > options.defs = defs; > ternserver = new Tern.Server(options); >+ _loadFiles(ternserver, options); > callback(err); > } > if(!options.plugins && (!defNames || defNames.length < 1)) { >@@ -547,6 +558,7 @@ > Deferred.all(loadDefs(defNames, ddir)).then(function(json) { > options.defs = json; > ternserver = new Tern.Server(options); >+ _loadFiles(ternserver, options); > callback(); > }, defaultStartUp); > }, defaultStartUp); >diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/ternWorkerCore.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/ternWorkerCore.js >index df48618..69bf13d 100644 >--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/ternWorkerCore.js >+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/ternWorkerCore.js >@@ -1,6 +1,6 @@ > /******************************************************************************* > * @license >- * Copyright (c) 2015 IBM Corporation and others. >+ * Copyright (c) 2015, 2016 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials are made > * available under the terms of the Eclipse Public License v1.0 > * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution >@@ -58,10 +58,13 @@ > var pluginsDir = defaultOptions.pluginsDir; > var defNames, plugins, projectLoc; > if (jsonOptions) { >- projectLoc = jsonOptions.projectLoc; >- plugins = jsonOptions.plugins; >+ projectLoc = jsonOptions.projectLoc; >+ plugins = jsonOptions.plugins; > pluginsDir = jsonOptions.pluginsDir; > defNames = jsonOptions.libs; >+ if(Array.isArray(jsonOptions.loadEagerly) && jsonOptions.loadEagerly.length > 0) { >+ options.loadEagerly = jsonOptions.loadEagerly; >+ } > if (typeof jsonOptions.ecmaVersion === 'number') { > options.ecmaVersion = jsonOptions.ecmaVersion; > } >@@ -82,21 +85,25 @@ > } > } > if(typeof plugins !== 'object') { >- plugins = null; >+ plugins = null; > } else { >- Objects.mixin(options.plugins, plugins); >+ Objects.mixin(options.plugins, plugins); > } > if(!Array.isArray(defNames)) { >- defNames = null; >+ defNames = null; > } > /** > * A subtlety - if the user provides no plugins entry at all, they get all the defaults, > * if they provide an empty object they still need the required ones only for a default startup > */ > var requiredOnly = plugins && Object.keys(plugins).length < 1; >+ /** >+ * @description Start the server with the default options >+ * @param {Error} err The error object from the failed deferred >+ */ > function defaultStartUp(err) { >- options.plugins = defaultOptions.plugins.required; >- if(!requiredOnly) { >+ options.plugins = defaultOptions.plugins.required; >+ if(!requiredOnly) { > Objects.mixin(options.plugins, defaultOptions.plugins.optional); > } > options.defs = defaultOptions.defs; >@@ -105,40 +112,51 @@ > post(Serialize.serializeError(err)); > } > } >+ /** >+ * @description Starts the tern server wit the given options >+ * @param {Object} options The options to start the server with >+ */ > function startAndMessage(options) { >- ternserver = new Tern.Server(options); >+ ternserver = new Tern.Server(options); >+ if(Array.isArray(options.loadEagerly) && options.loadEagerly.length > 0) { >+ options.loadEagerly.forEach(function(file) { >+ ternserver.addFile(file); >+ }); >+ } > callback({request: 'start_server', state: "server_ready"}); //$NON-NLS-1$ //$NON-NLS-2$ >- >- } >- if((!plugins || requiredOnly) && !defNames) { >+ } >+ if((!plugins || requiredOnly) && !defNames) { > defaultStartUp(); >- } else { >+ } else { > Deferred.all(loadPlugins(options.plugins, pluginsDir)).then(/* @callback */ function(plugins) { > if(defNames) { > if(defNames.length < 1) { > startAndMessage(options); > } else { > Deferred.all(loadDefs(defNames, projectLoc)).then(function(json) { >- options.defs = json; >- startAndMessage(options); >- }, defaultStartUp); >+ options.defs = json; >+ startAndMessage(options); >+ }, defaultStartUp); > } > } else { > startAndMessage(options); > } >- }, defaultStartUp); >- } >- } >+ }, defaultStartUp); >+ } >+ } > post({request: "worker_ready"}); //$NON-NLS-1$ > > var handlers = { >+ /* start_server message handler */ > 'start_server': function(args, callback){ > startServer(args.options, callback); > }, >+ /* addFile message handler */ > 'addFile': function(args, callback) { > ternserver.addFile(args.file, args.source); > callback({request: 'addFile'}); //$NON-NLS-1$ > }, >+ /* completions message handler */ > 'completions': function(args, callback) { > if(ternserver) { > ternserver.request({ >@@ -170,6 +188,7 @@ > callback({request: 'completions', message: Messages['failedToComputeProposalsNoServer']}); //$NON-NLS-1$ > } > }, >+ /* definition message handler */ > 'definition': function(args, callback) { > if(ternserver) { > ternserver.request({ >@@ -194,6 +213,7 @@ > callback({request: 'definition', message: Messages['failedToComputeDeclNoServer']}); //$NON-NLS-1$ > } > }, >+ /* delFile message handler */ > 'delFile': function(args, callback) { > if(ternserver && typeof args.file === 'string') { > ternserver.delFile(args.file); >@@ -202,6 +222,7 @@ > callback({request: 'delFile', message: i18nUtil.formatMessage(Messages['failedDeleteRequest'], args.file)}); //$NON-NLS-1$ > } > }, >+ /* documentation message handler */ > 'documentation': function(args, callback) { > if(ternserver) { > ternserver.request({ >@@ -225,9 +246,7 @@ > callback({request: 'documentation', message: Messages['failedToComputeDocNoServer']}); //$NON-NLS-1$ > } > }, >- /** >- * @callback >- */ >+ /* environments message handler */ > 'environments': function(args, callback) { > if(ternserver) { > ternserver.request({ >@@ -248,6 +267,7 @@ > callback({request: 'environments', message: Messages['failedGetEnvsNoServer']}); //$NON-NLS-1$ > } > }, >+ /* implementation message handler */ > 'implementation': function(args, callback) { > if(ternserver) { > ternserver.request({ >@@ -272,9 +292,7 @@ > callback({request: 'implementation', message: Messages['failedToComputeImplNoServer']}); //$NON-NLS-1$ > } > }, >- /** >- * @callback >- */ >+ /* installed_plugins message handler */ > 'installed_plugins': function(args, callback) { > if(ternserver) { > ternserver.request({ >@@ -295,9 +313,7 @@ > callback({request: 'installed_plugins', message: Messages['failedGetInstalledPluginsNoServer']}); //$NON-NLS-1$ > } > }, >- /** >- * @callback >- */ >+ /* installed_defs message handler */ > 'installed_defs': function(args, callback) { > if(ternserver) { > ternserver.request({ >@@ -318,6 +334,7 @@ > callback({request: 'installed_defs', message: Messages['failedGetInstalledDefsNoServer']}); //$NON-NLS-1$ > } > }, >+ /* rename message handler */ > 'rename': function(args, callback) { > if(ternserver) { > ternserver.request({ >@@ -341,6 +358,7 @@ > callback({request: 'rename', message: Messages['failedRenameNoServer']}); //$NON-NLS-1$ > } > }, >+ /* type message handler */ > 'type': function(args, callback) { > ternserver.request({ > query: { >@@ -356,6 +374,7 @@ > } > }); > }, >+ /* checkRef message handler */ > 'checkRef': function(args, callback) { > ternserver.request({ > query: { >@@ -373,6 +392,7 @@ > } > }); > }, >+ /* lint message handler */ > 'lint': function(args, callback) { > var query = > { >@@ -401,6 +421,7 @@ > } > }); > }, >+ /* outline message handler */ > 'outline': function(args, callback) { > ternserver.request({ > query: { >@@ -632,7 +653,7 @@ > } > return _defs; > } >- >+ > /** > * @description Delegate to actually load a definition > * @private >diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/ternProjectManager.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/ternProjectManager.js >index 4926d00..4b729c9 100644 >--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/ternProjectManager.js >+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/ternProjectManager.js >@@ -1,6 +1,6 @@ > /******************************************************************************* > * @license >- * Copyright (c) 2015 IBM Corporation and others. >+ * Copyright (c) 2015, 2016 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials are made > * available under the terms of the Eclipse Public License v1.0 > * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution >@@ -165,10 +165,10 @@ > * @param jsonOptions {Object} options to load into Tern > */ > loadTernProjectOptions: function(jsonOptions) { >- this.ternWorker.postMessage({request: "start_server", args: {options: jsonOptions}}); //$NON-NLS-1$ > if (Array.isArray(jsonOptions.loadEagerly)) { > var fileLoadPromises = []; > this._fileLoadWarnings = []; >+ var filesToLoad = []; > for (var i = 0; i < jsonOptions.loadEagerly.length; i++) { > var filename = jsonOptions.loadEagerly[i]; > var ext = 'js'; //$NON-NLS-1$ >@@ -182,9 +182,7 @@ > if (files.length > 1) { > this._fileLoadWarnings.push(i18nUtil.formatMessage(Messages['multipleFileMatchesProblem'], _filename, files[0].location)); > } >- this.ternWorker.postMessage( >- {request:'addFile', args:{file: files[0].location}} //$NON-NLS-1$ >- ); >+ filesToLoad.push(files[0].location); > } else { > this._fileLoadWarnings.push(i18nUtil.formatMessage(Messages['noFileMatchProblem'], _filename)); > } >@@ -193,7 +191,10 @@ > if (!this._hasValidationProblem){ > this.registry.getService("orion.page.message").setProgressMessage(Messages['fileMatchProgress']); //$NON-NLS-1$ > } >- return Deferred.all(fileLoadPromises).then(function(){ >+ var currentOptions = jsonOptions; >+ currentOptions.loadEagerly = filesToLoad; >+ if(fileLoadPromises.length > 0) { >+ Deferred.all(fileLoadPromises).then(function(){ > if (!this._hasValidationProblem){ // Don't hide validation warnings > this.registry.getService("orion.page.message").close(); //$NON-NLS-1$ > if (this._fileLoadWarnings.length > 0){ >@@ -208,7 +209,11 @@ > } > } > this._fileLoadWarnings = []; >+ this.ternWorker.postMessage({request: "start_server", args: {options: currentOptions}}); //$NON-NLS-1$ > }.bind(this)); >+ } else { >+ this.ternWorker.postMessage({request: "start_server", args: {options: currentOptions}}); //$NON-NLS-1$ >+ } > } > }, > >@@ -240,4 +245,4 @@ > return { > TernProjectManager : TernProjectManager > }; >-}); >\ No newline at end of file >+});
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 488530
:
259962
|
260016
|
260025