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 244175 Details for
Bug 424361
[outline] Style the JS Outliner
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]
Adds framework for styling and support for object property list
Bug 424361 - [outline] Style the JS Outliner.patch (text/plain), 6.49 KB, created by
Curtis Windatt
on 2014-06-11 16:50:02 EDT
(
hide
)
Description:
Adds framework for styling and support for object property list
Filename:
MIME Type:
Creator:
Curtis Windatt
Created:
2014-06-11 16:50:02 EDT
Size:
6.49 KB
patch
obsolete
> ><!-- saved from url=(0264)https://orion.eclipse.org/gitapi/diff/Cached/file/cwindatt-OrionContent/org.eclipse.orion.client-2/?parts=diff&Path=bundles/org.eclipse.orion.client.javascript/web/javascript/outliner.js&Path=bundles/org.eclipse.orion.client.javascript/web/javascript/signatures.js --> ><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><style type="text/css"></style></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/outliner.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/outliner.js >index dd9d7ba..978851e 100644 >--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/outliner.js >+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/outliner.js >@@ -133,6 +133,8 @@ > if(sig) { > var item = { > label: sig.sig, >+ labelPost: sig.details, >+// classNamePost: "status", //$NON-NLS-0$ > start: sig.range[0], > end: sig.range[1] > }; >diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/signatures.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/signatures.js >index 089f4a5..057cb7f 100644 >--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/signatures.js >+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/signatures.js >@@ -32,7 +32,8 @@ > } > var val = this.getNameFrom(astnode); > return { >- sig: val, >+ sig: val.name, >+ details: val.details, > range: this.getSignatureSourceRangeFrom(astnode) > }; > } >@@ -74,17 +75,65 @@ > }, > > /** >+ * @name getPropertyListFrom >+ * @description Retrieves the properties from the given AST node iff it a object declaration. >+ * @function >+ * @public >+ * @memberof javascript.Signatures.prototype >+ * @param {Object} astnode The AST node to compute the parameters from >+ * @param {Integer} maximum length of string to return, must be >= 5, defaults to 50 >+ * @returns {String} A list of named properties, comma separated in source defined order, surrounded by {}. >+ * Ellipsis will be added if properties are available or max length reached. >+ */ >+ getPropertyListFrom: function(astnode, maxLength) { >+ if (!maxLength){ >+ maxLength = 50; >+ } >+ if (maxLength < 5){ >+ maxLength = 5; >+ } >+ if(astnode) { >+ var props = astnode.properties; >+ if(props && props.length > 0) { >+ var length = props.length; >+ var value = '{'; //$NON-NLS-0$ >+ for(var i = 0; i < length; i++) { >+ if(props[i].key && props[i].key.name) { >+ value += props[i].key.name; >+ } else { >+ value += 'Object'; //$NON-NLS-0$ >+ } >+ if(i < length -1) { >+ value += ', '; //$NON-NLS-0$ >+ } >+ if (value.length > (maxLength-4)){ >+ value = value.substring(0, maxLength); >+ value += '...'; //$NON-NLS-0$ >+ break; >+ } >+ >+ } >+ value += '}'; //$NON-NLS-0$ >+ return value; >+ } >+ } >+ return '{...}'; //$NON-NLS-0$ >+ }, >+ >+ /** > * @name getNameFrom >- * @description Returns the name to display for the given AST node. If there is an attached doc node it >+ * @description Returns an object describing what to display for the given AST node. If there is an attached doc node it > * will be consulted to help compute the name to display > * @function > * @public > * @memberof javascript.Signatures.prototype > * @param {Object} astnode The AST node to compute the name from >- * @returns {String} The computed name to display for the node or <code>null</code> if one could not be computed >+ * @returns {String} An object containing 'name', the computed name to display for the node or <code>null</code> if one could not be >+ * computed and possibly 'details' if optional display information is computed > */ > getNameFrom: function(astnode) { > var name = "Anonyous " + astnode.type; //$NON-NLS-0$ >+ var details; > if(astnode && astnode.type) { > if(astnode.type === 'FunctionDeclaration') { //$NON-NLS-0$ > //TODO with the attached doc node we can augment this infos >@@ -95,7 +144,6 @@ > name += fparams; > } > name += ')'; //$NON-NLS-0$ >- return name; > } > } > else if(astnode.type === 'FunctionExpression') { //$NON-NLS-0$ >@@ -105,10 +153,10 @@ > name += feparams; > } > name += ')'; //$NON-NLS-0$ >- return name; > } > else if(astnode.type === 'ObjectExpression') { //$NON-NLS-0$ >- name = 'closure {...}'; //$NON-NLS-0$ >+ name = 'closure '; //$NON-NLS-0$ >+ details = this.getPropertyListFrom(astnode); > } > else if(astnode.type === 'Property') { //$NON-NLS-0$ > if(astnode.value) { >@@ -133,11 +181,12 @@ > else if(astnode.value.type === 'ObjectExpression') { //$NON-NLS-0$ > if(astnode.key) { > if(astnode.key.name) { >- name = astnode.key.name + ' {...}'; //$NON-NLS-0$ >+ name = astnode.key.name + ' '; //$NON-NLS-0$ > } > else if(astnode.key.value) { >- name = astnode.key.value + ' {...}'; //$NON-NLS-0$ >+ name = astnode.key.value + ' '; //$NON-NLS-0$ > } >+ details = this.getPropertyListFrom(astnode.value); > } > } > else if(astnode.key) { >@@ -154,7 +203,8 @@ > if(astnode.init) { > if(astnode.init.type === 'ObjectExpression') { //$NON-NLS-0$ > if(astnode.id && astnode.id.name) { >- name = 'var '+astnode.id.name+ ' = {...}'; //$NON-NLS-0$ //$NON-NLS-1$ >+ name = 'var '+astnode.id.name+ ' '; //$NON-NLS-0$ //$NON-NLS-1$ >+ details = this.getPropertyListFrom(astnode.init); > } > } > else if(astnode.init.type === 'FunctionExpression') { //$NON-NLS-0$ >@@ -185,7 +235,8 @@ > if(name) { > //append the right stuff > if(isobject) { >- name += ' {...}'; //$NON-NLS-0$ >+ name += ' '; //$NON-NLS-0$ >+ details = this.getPropertyListFrom(astnode.right); > } > else { > name += '('; //$NON-NLS-0$ >@@ -206,12 +257,13 @@ > if(astnode.argument) { > if(astnode.argument.type === 'ObjectExpression' || //$NON-NLS-0$ > astnode.argument.type === 'FunctionExpression') { //$NON-NLS-0$ >- name = 'return {...}'; //$NON-NLS-0$ >+ name = 'return '; //$NON-NLS-0$ >+ details = this.getPropertyListFrom(astnode.argument); > } > } > } > } >- return name; >+ return {name: name, details: details}; > }, > > /** ></pre></body></html>
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 424361
: 244175