summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <Silenio_Quarti@ca.ibm.com>2015-05-06 16:53:47 -0400
committerSilenio Quarti <Silenio_Quarti@ca.ibm.com>2015-05-06 16:53:47 -0400
commit47fb15afc8485618662f2a30eceafdbcd435750a (patch)
tree6f849c89a84f29b3c5be3d089024c00987af3003
parent6f628ae36bd475fe3b160e127d0de75e6aaf0291 (diff)
parent58528d3e29cec41aa8084df13508d82be750d235 (diff)
downloadorg.eclipse.orion.client-origin/silenio/removeBanner.zip
org.eclipse.orion.client-origin/silenio/removeBanner.tar.gz
org.eclipse.orion.client-origin/silenio/removeBanner.tar.bz2
Merge commit '58528d3e29cec41aa8084df13508d82be750d235' into silenio/removeBannerorigin/silenio/removeBanner
-rw-r--r--bundles/org.eclipse.orion.client.core/web/orion/plugin.js23
-rw-r--r--bundles/org.eclipse.orion.client.core/web/orion/pluginregistry.js65
-rw-r--r--bundles/org.eclipse.orion.client.core/web/orion/serialize.js1
-rw-r--r--bundles/org.eclipse.orion.client.javascript/web/javascript/astManager.js8
-rw-r--r--bundles/org.eclipse.orion.client.javascript/web/javascript/nls/root/messages.js15
-rw-r--r--bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/javascriptPlugin.js168
-rw-r--r--bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/ternWorker.js3
-rw-r--r--bundles/org.eclipse.orion.client.javascript/web/tern/lib/infer.js47
-rw-r--r--bundles/org.eclipse.orion.client.webtools/web/webtools/plugins/webToolsPlugin.js19
9 files changed, 208 insertions, 141 deletions
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/plugin.js b/bundles/org.eclipse.orion.client.core/web/orion/plugin.js
index fe2fa11..8ee21ea 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/plugin.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/plugin.js
@@ -24,7 +24,7 @@
this.__objectId = objectId;
this.__methods = methods;
}
-
+
function PluginProvider(headers) {
var _headers = headers;
var _connected = false;
@@ -60,9 +60,23 @@
}
}
var _notify = _publish;
- _publish({
- method: "loading", //$NON-NLS-0$
- });
+
+ var lastHeartbeat;
+ var startTime = new Date().getTime();
+ function log(state) {
+ if (localStorage.pluginLogging) console.log(state + "(" + (new Date().getTime() - startTime) + "ms)=" + window.location); //$NON-NLS-1$ //$NON-NLS-0$
+ }
+ function heartbeat() {
+ var time = new Date().getTime();
+ // This timeout depends on the handshake timeout of the plugin registry. Update both accordingly.
+ if (lastHeartbeat && time - lastHeartbeat < 4000) return;
+ lastHeartbeat = time;
+ _publish({
+ method: "loading", //$NON-NLS-0$
+ });
+ log("heartbeat"); //$NON-NLS-0$
+ }
+ heartbeat();
function _getPluginData() {
var services = [];
@@ -314,6 +328,7 @@
properties: properties || {},
listeners: {}
};
+ heartbeat();
};
this.registerServiceProvider = this.registerService;
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/pluginregistry.js b/bundles/org.eclipse.orion.client.core/web/orion/pluginregistry.js
index c0c3a51..c973fc0 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/pluginregistry.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/pluginregistry.js
@@ -13,7 +13,7 @@
/*eslint-env browser, amd*/
/*global URL*/
define(["orion/Deferred", "orion/EventTarget", "orion/URL-shim"], function(Deferred, EventTarget) {
-
+
function _equal(obj1, obj2) {
var keys1 = Object.keys(obj1);
var keys2 = Object.keys(obj2);
@@ -940,7 +940,12 @@ define(["orion/Deferred", "orion/EventTarget", "orion/URL-shim"], function(Defer
url: url
};
+ function log(state) {
+ if (localStorage.pluginLogging) console.log(state + "(" + (new Date().getTime() - channel._startTime) + "ms)=" + url); //$NON-NLS-1$ //$NON-NLS-0$
+ }
+
function sendTimeout(message) {
+ log("timeout"); //$NON-NLS-0$
var error = new Error(message);
error.name = "timeout";
handler({
@@ -950,33 +955,63 @@ define(["orion/Deferred", "orion/EventTarget", "orion/URL-shim"], function(Defer
}
timeout = timeout || _defaultTimeout;
+
+ channel._updateTimeout = function() {
+ var message, newTimeout;
+ if (!this._connected && !this._closed) {
+ if (this._handshake) {
+ // For each plugin being loaded add 1000 ms extra time to the handshake timeout
+ var extraTimeout = 0;
+ _channels.forEach(function(c) {
+ if (!c._connected && !c._closed) {
+ extraTimeout += 1000;
+ }
+ });
+ message = "Plugin handshake timeout for: " + url;
+ newTimeout = (this._loading ? 60000 : timeout || 5000) + extraTimeout;
+ } else {
+ message = "Plugin load timeout for: " + url;
+ newTimeout = timeout || 15000;
+ }
+ }
+ if (this._loadTimeout) clearTimeout(this._loadTimeout);
+ this._loadTimeout = 0;
+ if (newTimeout) this._loadTimeout = setTimeout(sendTimeout.bind(null, message), newTimeout);
+ };
- var loadTimeout = setTimeout(sendTimeout.bind(null, "Load timeout for: " + url), timeout || 15000);
+ channel._updateTimeout();
+ channel._startTime = new Date().getTime();
var iframe = document.createElement("iframe"); //$NON-NLS-0$
- iframe.name = url + "_" + new Date().getTime();
+ iframe.name = url + "_" + channel._startTime;
iframe.src = url;
iframe.onload = function() {
- clearTimeout(loadTimeout);
- loadTimeout = setTimeout(sendTimeout.bind(null, "Plugin handshake timeout for: " + url), timeout || 5000);
+ log("handshake"); //$NON-NLS-0$
+ channel._handshake = true;
+ channel._updateTimeout();
};
iframe.sandbox = "allow-scripts allow-same-origin allow-forms"; //$NON-NLS-0$
- iframe.style.width = iframe.style.height = "100%"; //$NON-NLS-0$
- iframe.frameBorder = 0;
+ iframe.style.width = iframe.style.height = "100%"; //$NON-NLS-0$
+ iframe.frameBorder = 0;
(parent || _parent).appendChild(iframe);
channel.target = iframe.contentWindow;
channel.connected = function() {
- clearTimeout(loadTimeout);
+ log("connected"); //$NON-NLS-0$
+ this._connected = true;
+ this._updateTimeout();
};
channel.loading = function() {
- clearTimeout(loadTimeout);
- loadTimeout = setTimeout(sendTimeout.bind(null, "Plugin handshake timeout for: " + url), 60000);
+ log("loading"); //$NON-NLS-0$
+ this._loading = true;
+ this._updateTimeout();
};
channel.close = function() {
- clearTimeout(loadTimeout);
+ log("closed"); //$NON-NLS-0$
+ this._closed = true;
+ this._updateTimeout();
if (iframe) {
- var parent = iframe.parentNode;
- if (parent) {
- parent.removeChild(iframe);
+ var frameParent = iframe.parentNode;
+ if (frameParent) {
+ frameParent.removeChild(iframe);
}
iframe = null;
}
@@ -1036,6 +1071,8 @@ define(["orion/Deferred", "orion/EventTarget", "orion/URL-shim"], function(Defer
internalRegistry.disconnect(channel);
channel = null;
d.reject(message.error);
+ } else if ("loading" === message.method) {
+ channel.loading();
}
});
return d.promise;
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/serialize.js b/bundles/org.eclipse.orion.client.core/web/orion/serialize.js
index d772331..7fe63f3 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/serialize.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/serialize.js
@@ -21,6 +21,7 @@ define([], function() {
var result = error ? JSON.parse(JSON.stringify(error)) : error; // sanitizing Error object
if (error instanceof Error) {
result.__isError = true;
+ result.lineNumber = typeof(result.lineNumber) === 'number' ? result.lineNumber : error.lineNumber; //FF fails to include the line number from JSON.stringify
result.message = result.message || error.message;
result.name = result.name || error.name;
result.stack = result.stack || error.stack;
diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/astManager.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/astManager.js
index 2d73015..7dc567c 100644
--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/astManager.js
+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/astManager.js
@@ -49,7 +49,7 @@ define([
this.parser = esprima;
this.cache = new LRU.LRU(10);
if (!this.parser) {
- throw new Error("Missing parser");
+ throw new Error("Missing parser"); //$NON-NLS-1$
}
}
@@ -67,7 +67,7 @@ define([
return new Deferred().resolve(ast);
}
return editorContext.getText().then(function(text) {
- ast = _self.parse(text, metadata ? metadata.location : 'unknown');
+ ast = _self.parse(text, metadata ? metadata.location : 'unknown'); //$NON-NLS-1$
_self.cache.put(loc, ast);
return ast;
});
@@ -80,7 +80,7 @@ define([
*/
_getKey: function _getKey(metadata) {
if(!metadata || !metadata.location) {
- return 'unknown';
+ return 'unknown'; //$NON-NLS-1$
}
return metadata.location;
},
@@ -108,7 +108,7 @@ define([
ast.errors = [e];
}
var end = Date.now() - start;
- Metrics.logTiming('language tools', 'parse', end, 'application/javascript');
+ Metrics.logTiming('language tools', 'parse', end, 'application/javascript'); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (ast.errors) {
this._computeErrorTypes(ast.errors);
ast.errors = ast.errors.map(Serialize.serializeError);
diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/nls/root/messages.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/nls/root/messages.js
index edf7d74..1f73b9d 100644
--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/nls/root/messages.js
+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/nls/root/messages.js
@@ -66,38 +66,23 @@ define({//Default message bundle
'noSparseArrays': 'Sparse array declarations', //$NON-NLS-0$ //$NON-NLS-1$
'jsHover': 'JavaScript Hover Provider', //$NON-NLS-0$ //$NON-NLS-1$
'removeExtraSemiFixName': 'Remove extra semicolon', //$NON-NLS-0$ //$NON-NLS-1$
- 'removeExtraSemiFixTooltip': 'Removes the extra semicolon', //$NON-NLS-0$ //$NON-NLS-1$
'addFallthroughCommentFixName': 'Add $FALLTHROUGH$ comment', //$NON-NLS-0$ //$NON-NLS-1$
- 'addFallthroughCommentFixTooltip': 'Add the $FALLTHROUGH$ line comment', //$NON-NLS-0$ //$NON-NLS-1$
'addEmptyCommentFixName': 'Comment empty block', //$NON-NLS-0$ //$NON-NLS-1$
- 'addEmptyCommentFixTooltip': 'Add a TODO comment to the empty block', //$NON-NLS-0$ //$NON-NLS-1$
'addESLintEnvFixName': 'Add to eslint-env directive', //$NON-NLS-0$ //$NON-NLS-1$
- 'addESLintEnvFixTooltip': 'Add to eslint-env directive to filter the known member', //$NON-NLS-0$ //$NON-NLS-1$
'addESLintGlobalFixName': 'Add to globals directive', //$NON-NLS-0$ //$NON-NLS-1$
- 'addESLintGlobalFixTooltip': 'Add to globals directive to filter the unknown member', //$NON-NLS-0$ //$NON-NLS-1$
'removeUnusedParamsFixName': 'Remove parameter', //$NON-NLS-0$ //$NON-NLS-1$
- 'removeUnusedParamsFixTooltip': 'Remove the unused parameter, keeping side effects', //$NON-NLS-0$ //$NON-NLS-1$
'commentCallbackFixName': 'Add @callback to function', //$NON-NLS-0$ //$NON-NLS-1$
- 'commentCallbackFixTooltip': 'Document the function with @callback, ignoring unused parameters', //$NON-NLS-0$ //$NON-NLS-1$
'eqeqeqFixName': 'Update operator', //$NON-NLS-0$ //$NON-NLS-1$
- 'eqeqeqFixTooltip': 'Update the operator to the expected one', //$NON-NLS-0$ //$NON-NLS-1$
'unreachableFixName': 'Remove unreachable code', //$NON-NLS-0$ //$NON-NLS-1$
- 'unreachableFixTooltip': 'Remove the unreachable code', //$NON-NLS-0$ //$NON-NLS-1$
'sparseArrayFixName': 'Convert to normal array', //$NON-NLS-0$ //$NON-NLS-1$
- 'sparseArrayFixTooltip': 'Remove sparse entries and convert to normal array', //$NON-NLS-0$ //$NON-NLS-1$
'semiFixName': 'Add missing \';\'', //$NON-NLS-0$ //$NON-NLS-1$
- 'semiFixTooltip': 'Add the missing \';\'', //$NON-NLS-0$ //$NON-NLS-1$
'radix': 'Missing radix parameter to parseInt()', //$NON-NLS-0$ //$NON-NLS-1$
'unusedVarsUnusedFixName': 'Remove unused variable', //$NON-NLS-0$ //$NON-NLS-1$
- 'unusedVarsUnusedFixTooltip': 'Remove the unused variable, keeping side effects', //$NON-NLS-0$ //$NON-NLS-1$
'unusedFuncDeclFixName': 'Remove unused function', //$NON-NLS-0$ //$NON-NLS-1$
- 'unusedFuncDeclFixTooltip': 'Remove the unused function, keeping side effects', //$NON-NLS-0$ //$NON-NLS-1$
'noCommaDangleFixName': 'Remove extra \',\'', //$NON-NLS-0$ //$NON-NLS-1$
- 'noCommaDangleFixTooltip': 'Remove the extra comma', //$NON-NLS-0$ //$NON-NLS-1$
'addBBreakFixName': 'Add break statement', //$NON-NLS-0$ //$NON-NLS-1$
'addBBreakFixTooltip': 'Add a break statement to the proceeding line', //$NON-NLS-0$ //$NON-NLS-1$
'noShadowGlobals': 'Global shadowing:', //$NON-NLS-0$ //$NON-NLS-1$
'noThrowLiteralFixName': 'Change to Error' , //$NON-NLS-0$ //$NON-NLS-1$
- 'noThrowLiteralFixTooltip': 'Change the literal to an Error', //$NON-NLS-0$ //$NON-NLS-1$
'missingNlsFixName': 'Add missing $NON-NLS$ tag' //$NON-NLS-0$ //$NON-NLS-1$
});
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 1a92595..e4b40a5 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
@@ -42,13 +42,13 @@ define([
], function(PluginProvider, Bootstrap, FileClient, Metrics, Esprima, Estraverse, ScriptResolver, ASTManager, QuickFixes, TernAssist,
EslintValidator, Occurrences, Hover, Outliner, Util, Logger, GenerateDocCommand, OpenDeclCommand, RenameCommand, mJS, mJSON, mJSONSchema, mEJS, javascriptMessages) {
- Bootstrap.startup().then(function(core) {
+ var provider = new PluginProvider({
+ name: javascriptMessages['pluginName'], //$NON-NLS-0$
+ version: "1.0", //$NON-NLS-0$
+ description: javascriptMessages['pluginDescription'] //$NON-NLS-0$
+ });
- var provider = new PluginProvider({
- name: javascriptMessages['pluginName'], //$NON-NLS-0$
- version: "1.0", //$NON-NLS-0$
- description: javascriptMessages['pluginDescription'] //$NON-NLS-0$
- });
+ Bootstrap.startup().then(function(core) {
/**
* Register the JavaScript content types
@@ -63,7 +63,7 @@ define([
}, {id: "application/json", //$NON-NLS-0$
"extends": "text/plain", //$NON-NLS-0$ //$NON-NLS-1$
name: "JSON", //$NON-NLS-0$
- extension: ["json", "pref"], //$NON-NLS-0$ //$NON-NLS-1$
+ extension: ["json", "pref"], //$NON-NLS-1$ //$NON-NLS-2$
imageClass: "file-sprite-javascript modelDecorationSprite" //$NON-NLS-0$
}, {id: "application/x-ejs", //$NON-NLS-0$
"extends": "text/plain", //$NON-NLS-0$ //$NON-NLS-1$
@@ -166,7 +166,7 @@ define([
provider.registerService("orion.edit.contentassist", new TernAssist.TernContentAssist(astManager, ternWorker), //$NON-NLS-0$
{
- contentType: ["application/javascript", "text/html"], //$NON-NLS-0$
+ contentType: ["application/javascript", "text/html"], //$NON-NLS-0$ //$NON-NLS-2$
nls: 'javascript/nls/messages', //$NON-NLS-0$
name: 'ternContentAssist', //$NON-NLS-0$
id: "orion.edit.contentassist.javascript.tern", //$NON-NLS-0$
@@ -189,7 +189,7 @@ define([
*/
provider.registerService("orion.edit.occurrences", new Occurrences.JavaScriptOccurrences(astManager), //$NON-NLS-0$
{
- contentType: ["application/javascript", "text/html"] //$NON-NLS-0$ //$NON-NLS-1$
+ contentType: ["application/javascript", "text/html"] //$NON-NLS-0$ //$NON-NLS-2$
});
/**
@@ -198,7 +198,7 @@ define([
provider.registerService("orion.edit.hover", new Hover.JavaScriptHover(astManager, scriptresolver, ternWorker), //$NON-NLS-0$
{
name: javascriptMessages['jsHover'],
- contentType: ["application/javascript", "text/html"] //$NON-NLS-0$ //$NON-NLS-1$
+ contentType: ["application/javascript", "text/html"] //$NON-NLS-0$ //$NON-NLS-2$
});
var validator = new EslintValidator(astManager);
@@ -206,9 +206,9 @@ define([
/**
* Register the ESLint validator
*/
- provider.registerService("orion.edit.validator", validator, //$NON-NLS-0$ //$NON-NLS-1$
+ provider.registerService("orion.edit.validator", validator, //$NON-NLS-0$ //$NON-NLS-2$
{
- contentType: ["application/javascript", "text/html"], //$NON-NLS-0$ //$NON-NLS-1$
+ contentType: ["application/javascript", "text/html"], //$NON-NLS-0$ //$NON-NLS-2$
pid: 'eslint.config' //$NON-NLS-0$
});
@@ -220,8 +220,8 @@ define([
onInputChanged: astManager.onInputChanged.bind(astManager)
},
{
- contentType: ["application/javascript", "text/html"], //$NON-NLS-0$
- types: ["ModelChanging", 'Destroy', 'onSaving', 'onInputChanged'] //$NON-NLS-0$ //$NON-NLS-1$
+ contentType: ["application/javascript", "text/html"], //$NON-NLS-0$ //$NON-NLS-2$
+ types: ["ModelChanging", 'Destroy', 'onSaving', 'onInputChanged'] //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
});
provider.registerServiceProvider("orion.edit.command", //$NON-NLS-0$
@@ -231,7 +231,7 @@ define([
tooltip : javascriptMessages['generateDocTooltip'], //$NON-NLS-0$
id : "generate.js.doc.comment", //$NON-NLS-0$
key : [ "j", false, true, !Util.isMac, Util.isMac], //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'] //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'] //$NON-NLS-0$ //$NON-NLS-2$
}
);
@@ -263,12 +263,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["removeExtraSemiFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['removeExtraSemiFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "rm.extra.semi.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "no-extra-semi"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-extra-semi)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -277,12 +276,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["addFallthroughCommentFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['addFallthroughCommentFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "add.fallthrough.comment.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-fallthrough)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-fallthrough)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -291,19 +289,18 @@ define([
{
execute: function(editorContext, context) {
if(context.annotation.id === 'no-fallthrough') {
- context.annotation.fixid = 'no-fallthrough-break';
+ context.annotation.fixid = 'no-fallthrough-break'; //$NON-NLS-1$
}
return quickFixComputer.execute(editorContext, context);
}
},
{
name: javascriptMessages["addBBreakFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['addBreakFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "add.fallthrough.break.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-fallthrough)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-fallthrough)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -312,12 +309,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["addEmptyCommentFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['addEmptyCommentFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "add.empty.comment.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-empty-block)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-empty-block)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -326,12 +322,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["addESLintEnvFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['addESLintEnvFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "add.eslint-env.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-undef-defined-inenv)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-undef-defined-inenv)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -340,12 +335,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["addESLintGlobalFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['addESLintGlobalFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "add.eslint-global.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-undef-defined)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-undef-defined)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -354,7 +348,7 @@ define([
{
execute: function(editorContext, context) {
if(context.annotation.id === 'no-unused-params-expr') {
- context.annotation.fixid = 'no-unused-params';
+ context.annotation.fixid = 'no-unused-params'; //$NON-NLS-1$
//return quickFixComputer['no-unused-params'](editorContext, context.annotation, astManager);
}
return quickFixComputer.execute(editorContext, context);
@@ -362,12 +356,11 @@ define([
},
{
name: javascriptMessages["removeUnusedParamsFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['removeUnusedParamsFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "remove.unused.param.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-unused-params|no-unused-params-expr)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-unused-params|no-unused-params-expr)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -376,12 +369,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["commentCallbackFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['commentCallbackFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "comment.callback.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-unused-params-expr)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-unused-params-expr)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -390,12 +382,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["eqeqeqFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['eqeqeqFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "eqeqeq.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:eqeqeq)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:eqeqeq)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -404,12 +395,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["unreachableFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['unreachableFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "remove.unreachable.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-unreachable)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-unreachable)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -418,12 +408,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["sparseArrayFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['sparseArrayFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "sparse.array.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-sparse-arrays)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-sparse-arrays)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -432,12 +421,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["semiFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['semiFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "semi.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:semi)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:semi)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -446,12 +434,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["unusedVarsUnusedFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['unusedVarsUnusedFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "unused.var.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-unused-vars-unused)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-unused-vars-unused)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -460,12 +447,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["unusedFuncDeclFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['unusedFuncDeclFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "unused.func.decl.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-unused-vars-unused-funcdecl)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-unused-vars-unused-funcdecl)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -474,12 +460,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["noCommaDangleFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['noCommaDangleFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "no.comma.dangle.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-comma-dangle)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-comma-dangle)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -488,12 +473,11 @@ define([
quickFixComputer,
{
name: javascriptMessages["noThrowLiteralFixName"], //$NON-NLS-0$
- tooltip : javascriptMessages['noThrowLiteralFixTooltip'], //$NON-NLS-0$
- scopeId: "orion.edit.quickfix",
+ scopeId: "orion.edit.quickfix", //$NON-NLS-1$
id : "no.throw.literal.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:no-throw-literal)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:no-throw-literal)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -503,10 +487,10 @@ define([
{
name: javascriptMessages["missingNlsFixName"], //$NON-NLS-0$
scopeId: "orion.edit.quickfix", //$NON-NLS-0$
- id : "no.throw.literal.fix", //$NON-NLS-0$
- contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-1$
+ id : "missing.nls.fix", //$NON-NLS-0$
+ contentType: ['application/javascript', 'text/html'], //$NON-NLS-0$ //$NON-NLS-1$ //$NON-NLS-2$
validationProperties: [
- {source: "annotation:id", match: "^(?:missing-nls)$"} //$NON-NLS-1$ //$NON-NLS-0$
+ {source: "annotation:id", match: "^(?:missing-nls)$"} //$NON-NLS-1$ //$NON-NLS-2$
]
}
);
@@ -514,13 +498,13 @@ define([
/**
* legacy pref id
*/
- provider.registerService("orion.cm.managedservice", validator, {pid: "eslint.config"});
+ provider.registerService("orion.cm.managedservice", validator, {pid: "eslint.config"}); //$NON-NLS-1$ //$NON-NLS-2$
/**
* new sectioned pref block ids
*/
- provider.registerService("orion.cm.managedservice", validator, {pid: "eslint.config.potential"});
- provider.registerService("orion.cm.managedservice", validator, {pid: "eslint.config.practices"});
- provider.registerService("orion.cm.managedservice", validator, {pid: "eslint.config.codestyle"});
+ provider.registerService("orion.cm.managedservice", validator, {pid: "eslint.config.potential"}); //$NON-NLS-1$ //$NON-NLS-2$
+ provider.registerService("orion.cm.managedservice", validator, {pid: "eslint.config.practices"}); //$NON-NLS-1$ //$NON-NLS-2$
+ provider.registerService("orion.cm.managedservice", validator, {pid: "eslint.config.codestyle"}); //$NON-NLS-1$ //$NON-NLS-2$
/**
* ESLint settings
@@ -586,13 +570,13 @@ define([
defaultValue: error,
options: severities
},
- { id: "no-reserved-keys",
+ { id: "no-reserved-keys", //$NON-NLS-1$
name: javascriptMessages["noReservedKeys"], //$NON-NLS-0$
type: "number", //$NON-NLS-0$
defaultValue: error, //$NON-NLS-0$
options: severities //$NON-NLS-0$
},
- { id: "no-sparse-arrays",
+ { id: "no-sparse-arrays", //$NON-NLS-1$
name: javascriptMessages["noSparseArrays"], //$NON-NLS-0$
type: "number", //$NON-NLS-0$
defaultValue: warning,
@@ -753,7 +737,7 @@ define([
name: javascriptMessages['prefCodeStyle'], //$NON-NLS-0$
tags: "validation javascript js eslint".split(" "), //$NON-NLS-0$ //$NON-NLS-1$
category: "javascript", //$NON-NLS-0$
- properties: [{ id: "missing-doc",
+ properties: [{ id: "missing-doc", //$NON-NLS-1$
name: javascriptMessages["missingDoc"], //$NON-NLS-0$
type: "number", //$NON-NLS-0$
defaultValue: ignore,
@@ -804,7 +788,7 @@ define([
});
for (var current in newGrammars) {
if (newGrammars.hasOwnProperty(current)) {
- provider.registerService("orion.edit.highlighter", {}, newGrammars[current]);
+ provider.registerService("orion.edit.highlighter", {}, newGrammars[current]); //$NON-NLS-1$
}
}
provider.connect();
diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/ternWorker.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/ternWorker.js
index 6ff27db..649032e 100644
--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/ternWorker.js
+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/plugins/ternWorker.js
@@ -198,8 +198,7 @@ require({
if(typeof(read) === 'function') {
read(err, contents);
}
- file = args.logical;
- read = pendingReads[file];
+ read = pendingReads[args.logical];
if(typeof(read) === 'function') {
read(err, {contents: contents, file:file, logical:args.logical});
}
diff --git a/bundles/org.eclipse.orion.client.javascript/web/tern/lib/infer.js b/bundles/org.eclipse.orion.client.javascript/web/tern/lib/infer.js
index 6fa038c..1090fb6 100644
--- a/bundles/org.eclipse.orion.client.javascript/web/tern/lib/infer.js
+++ b/bundles/org.eclipse.orion.client.javascript/web/tern/lib/infer.js
@@ -1158,6 +1158,13 @@
if (arr) for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args);
}
+ var emptyAST = Object.create(null);
+ emptyAST.type = "Program"; //$NON-NLS-0$
+ emptyAST.body = [];
+ emptyAST.comments = [];
+ emptyAST.tokens = [];
+ emptyAST.range = [0, 0];
+
var parse = exports.parse = function(text, passes, options) {
var ast;
try {
@@ -1174,11 +1181,49 @@
ast.sourceFile.name = ast.fileLocation;
}
//ORION
- catch(e) { /*ast = acorn_loose.parse_dammit(text, options);*/ }
+ catch(e) {
+ ast = emptyAST;
+ ast.range[1] = (text && typeof text.length === "number") ? text.length : 0; //$NON-NLS-0$
+ ast.errors = [e];
+ }
+ if (ast.errors) {
+ _computeErrorTypes(ast.errors);
+ ast.errors = ast.errors.map(serializeError);
+ }
runPasses(passes, "postParse", ast, text);
return ast;
};
+ //ORION
+ function serializeError(error) {
+ var result = error ? JSON.parse(JSON.stringify(error)) : error; // sanitizing Error object
+ if (error instanceof Error) {
+ result.__isError = true;
+ result.lineNumber = typeof(result.lineNumber) === 'number' ? result.lineNumber : error.lineNumber; //FF fails to include the line number from JSON.stringify
+ result.message = result.message || error.message;
+ result.name = result.name || error.name;
+ result.stack = result.stack || error.stack;
+ }
+ return result;
+}
+
+ //ORION
+ function _computeErrorTypes(errors) {
+ if(errors && Array.isArray(errors)) {
+ errors.forEach(function(error) {
+ var msg = error.message;
+ //first sanitize it
+ error.message = msg = msg.replace(/^Line \d+: /, '');
+ if(/^Unexpected/.test(msg)) {
+ error.type = 1;
+ if(/end of input$/.test(msg)) {
+ error.type = 2;
+ }
+ }
+ });
+ }
+}
+
// ANALYSIS INTERFACE
exports.analyze = function(ast, name, scope, passes) {
diff --git a/bundles/org.eclipse.orion.client.webtools/web/webtools/plugins/webToolsPlugin.js b/bundles/org.eclipse.orion.client.webtools/web/webtools/plugins/webToolsPlugin.js
index 71ea190..baac214 100644
--- a/bundles/org.eclipse.orion.client.webtools/web/webtools/plugins/webToolsPlugin.js
+++ b/bundles/org.eclipse.orion.client.webtools/web/webtools/plugins/webToolsPlugin.js
@@ -31,16 +31,17 @@ define(['orion/plugin',
], function(PluginProvider, Bootstrap, FileClient, Metrics, HtmlAstManager, htmlHover, ScriptResolver, htmlContentAssist, htmlOutliner,
mHTML, cssContentAssist, mCssValidator, mCssOutliner, cssHover, cssQuickFixes, cssResultManager, mCSS, messages) {
+ /**
+ * Plug-in headers
+ */
+ var headers = {
+ name: messages["pluginName"], //$NON-NLS-0$
+ version: "1.0", //$NON-NLS-0$
+ description: messages["pluginDescription"] //$NON-NLS-0$
+ };
+ var provider = new PluginProvider(headers);
+
Bootstrap.startup().then(function(core) {
- /**
- * Plug-in headers
- */
- var headers = {
- name: messages["pluginName"], //$NON-NLS-0$
- version: "1.0", //$NON-NLS-0$
- description: messages["pluginDescription"] //$NON-NLS-0$
- };
- var provider = new PluginProvider(headers);
/**
* Register the content types: HTML, CSS