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 260025 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]
Proposed patch
488530.patch (text/plain), 16.95 KB, created by
Olivier Thomann
on 2016-03-01 17:08:02 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2016-03-01 17:08:02 EST
Size:
16.95 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..a101a3a 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); >@@ -736,4 +748,4 @@ > } > > return TernServer; >-}); >\ No newline at end of file >+}); >diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/javascriptPlugin.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/javascriptPlugin.js >index 6292ef9..e00e9b7 100644 >--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/javascriptPlugin.js >+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/javascriptPlugin.js >@@ -115,6 +115,11 @@ > this.callbacks = Object.create(null); > } > >+ function setStarting() { >+ ternReady = false; >+ } >+ >+ > WrappedWorker.prototype.postMessage = function(msg, f) { > var starting = msg.request === "start_server"; > if(starting) { >@@ -214,10 +219,9 @@ > response.args.path = rel[0].path; > ternWorker.postMessage(response); > }); >- } else { >- response.args.error = i18nUtil.formatMessage(javascriptMessages['failedToReadFile'], _l); >- ternWorker.postMessage(response); > } >+ response.args.error = i18nUtil.formatMessage(javascriptMessages['failedToReadFile'], _l); >+ ternWorker.postMessage(response); > } else { > response.args.error = i18nUtil.formatMessage(javascriptMessages['failedToReadFile'], _l); > ternWorker.postMessage(response); >@@ -426,7 +430,7 @@ > types: ["ModelChanging", 'onInputChanged'] //$NON-NLS-1$ //$NON-NLS-2$ > }); > >- var ternProjectManager = new TernProjectManager.TernProjectManager(ternWorker, scriptresolver, serviceRegistry); >+ var ternProjectManager = new TernProjectManager.TernProjectManager(ternWorker, scriptresolver, serviceRegistry, setStarting); > /** > * Register Tern project manager as input changed listener > */ >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..6bb6d54 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 >@@ -29,12 +29,13 @@ > * @param {ServiceRegistry} serviceRegistry The service registry > * @since 8.0 > */ >- function TernProjectManager(ternWorker, scriptResolver, serviceRegistry) { >+ function TernProjectManager(ternWorker, scriptResolver, serviceRegistry, setStarting) { > this.ternWorker = ternWorker; > this.scriptResolver = scriptResolver; > this.currentProjectLocation = null; > this.currentFile = null; > this.registry = serviceRegistry; >+ this.starting = setStarting; > } > > Objects.mixin(TernProjectManager.prototype, { >@@ -165,10 +166,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)) { >+ if (Array.isArray(jsonOptions.loadEagerly) && jsonOptions.loadEagerly.length > 0) { > 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 +183,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,22 +192,30 @@ > if (!this._hasValidationProblem){ > this.registry.getService("orion.page.message").setProgressMessage(Messages['fileMatchProgress']); //$NON-NLS-1$ > } >- return 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){ >- var message = ""; >- for (var j=0; j<this._fileLoadWarnings.length && j<10; j++) { >- message += this._fileLoadWarnings[j] + '<br>'; //$NON-NLS-1$ >+ var currentOptions = jsonOptions; >+ currentOptions.loadEagerly = filesToLoad; >+ if(fileLoadPromises.length > 0) { >+ return 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){ >+ var message = ""; >+ for (var j=0; j<this._fileLoadWarnings.length && j<10; j++) { >+ message += this._fileLoadWarnings[j] + '<br>'; //$NON-NLS-1$ >+ } >+ if (this._fileLoadWarnings.length > 10){ >+ message += i18nUtil.formatMessage(Messages['tooManyFileMatchProblems'],this._fileLoadWarnings.length-10) + '<br>'; //$NON-NLS-1$ >+ } >+ this._report(Messages['fileMatchProblems'], message); > } >- if (this._fileLoadWarnings.length > 10){ >- message += i18nUtil.formatMessage(Messages['tooManyFileMatchProblems'],this._fileLoadWarnings.length-10) + '<br>'; //$NON-NLS-1$ >- } >- this._report(Messages['fileMatchProblems'], message); > } >- } >- this._fileLoadWarnings = []; >- }.bind(this)); >+ this._fileLoadWarnings = []; >+ this.ternWorker.postMessage({request: "start_server", args: {options: currentOptions}}); //$NON-NLS-1$ >+ }.bind(this)); >+ } >+ this.ternWorker.postMessage({request: "start_server", args: {options: currentOptions}}); //$NON-NLS-1$ >+ } else { >+ this.ternWorker.postMessage({request: "start_server", args: {options: currentOptions}}); //$NON-NLS-1$ > } > }, > >@@ -227,6 +234,7 @@ > if (projectFile && (!this.currentProjectLocation || projectFile.Location !== this.currentProjectLocation)){ > this.currentProjectLocation = projectFile.Location; > this.scriptResolver.setSearchLocation(projectFile.Location); >+ this.starting(); > return this.getTernProjectFileLocation(projectFile).then(function(ternFileLocation){ > return this.parseTernJSON(ternFileLocation).then(function(jsonOptions){ > return this.loadTernProjectOptions(jsonOptions); >@@ -240,4 +248,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