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 261272 Details for
Bug 492470
All JS code completions are available inside of string literals
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]
Remove templates from string completions
changes (21).patch (text/plain), 3.60 KB, created by
Curtis Windatt
on 2016-04-26 16:45:05 EDT
(
hide
)
Description:
Remove templates from string completions
Filename:
MIME Type:
Creator:
Curtis Windatt
Created:
2016-04-26 16:45:05 EDT
Size:
3.60 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/contentAssist/ternAssist.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/contentAssist/ternAssist.js >index 6702032..ec9dde2 100644 >--- a/bundles/org.eclipse.orion.client.javascript/web/javascript/contentAssist/ternAssist.js >+++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/contentAssist/ternAssist.js >@@ -122,6 +124,10 @@ define([ > getKind: function(ast, offset) { > var node = Finder.findNode(offset, ast, {parents:true}); > if(node) { >+ if (node.type === 'Literal' && typeof node.value === 'string' && offset > node.range[0] && offset < node.range[1]){ >+ // If we are inside the quotes of a string literal, don't offer template completions >+ return {kind: 'string'}; >+ } > if(node.parents && node.parents.length > 0) { > var prent = node.parents.pop(); > switch(prent.type) { >@@ -43,42 +43,44 @@ define([ > getTemplateProposals: function(prefix, offset, context, ast) { > var proposals = []; > var k = this.getKind(ast, offset); >- var templates = Templates.getTemplatesForKind(k.kind); >- for (var t = 0; t < templates.length; t++) { >- var template = templates[t]; >- if (this.templateMatches(template, prefix, k, context)) { >- var proposal = template.getProposal(prefix, offset, context); >- var _h; >- if(template.doc) { >- _h = Hover.formatMarkdownHover(template.doc); >- } else { >- _h = Object.create(null); >- _h.type = 'markdown'; //$NON-NLS-1$ >- _h.content = Messages['templateHoverHeader']; >- _h.content += proposal.proposal; >- } >- if(template.url) { >- _h.content += i18nUtil.formatMessage.call(null, Messages['onlineDocumentationProposalEntry'], template.url); >- } >- proposal.hover = _h; >- proposal.style = 'emphasis'; //$NON-NLS-1$ >- this.removePrefix(prefix, proposal); >- proposal.kind = 'js'; //$NON-NLS-1$ >- proposals.push(proposal); >- } >- } >- >- if (0 < proposals.length) { >- //sort the proposals by name >- proposals.sort(function(p1, p2) { >- if (p1.name < p2.name) { >- return -1; >- } >- if (p1.name > p2.name) { >- return 1; >+ if (k){ >+ var templates = Templates.getTemplatesForKind(k.kind); >+ for (var t = 0; t < templates.length; t++) { >+ var template = templates[t]; >+ if (this.templateMatches(template, prefix, k, context)) { >+ var proposal = template.getProposal(prefix, offset, context); >+ var _h; >+ if(template.doc) { >+ _h = Hover.formatMarkdownHover(template.doc); >+ } else { >+ _h = Object.create(null); >+ _h.type = 'markdown'; //$NON-NLS-1$ >+ _h.content = Messages['templateHoverHeader']; >+ _h.content += proposal.proposal; >+ } >+ if(template.url) { >+ _h.content += i18nUtil.formatMessage.call(null, Messages['onlineDocumentationProposalEntry'], template.url); >+ } >+ proposal.hover = _h; >+ proposal.style = 'emphasis'; //$NON-NLS-1$ >+ this.removePrefix(prefix, proposal); >+ proposal.kind = 'js'; //$NON-NLS-1$ >+ proposals.push(proposal); > } >- return 0; >- }); >+ } >+ >+ if (0 < proposals.length) { >+ //sort the proposals by name >+ proposals.sort(function(p1, p2) { >+ if (p1.name < p2.name) { >+ return -1; >+ } >+ if (p1.name > p2.name) { >+ return 1; >+ } >+ return 0; >+ }); >+ } > } > return proposals; > },
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 492470
:
261263
| 261272