Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 389928

Summary: Template proposals always showing up in content assist even when it doesn't make sense
Product: [ECD] Orion Reporter: Andrew Eisenberg <andrew.eisenberg>
Component: EditorAssignee: Project Inbox <orion.editor-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.5   
Target Milestone: 0.5 M2   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Andrew Eisenberg CLA 2012-09-19 14:08:00 EDT
Consider this js snippet:

this.for|

content assist at the | will show the templates for 'for'.  This doesn't make sense.  the Template content assist plugin should provide no results if the previous token is a '.' or '(', and perhaps some other keywords as well.
Comment 1 Andrew Eisenberg CLA 2012-09-19 16:10:42 EDT
Fixed.  Added a small function that looks for the previous newline or non-whitespace char.  

If the previous char is a newline, then we assume that templates are fine to propose.  If previous char is other, then we check against a hardcoded list of chars :!@#$%^&*.<>

This is far from perfect, but I think it is sufficient for our circumstances.
Comment 2 Andrew Eisenberg CLA 2012-09-19 16:12:51 EDT
Commit is pushed with regression tests.  Commit is here:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=03ab15dc9027d9fd98bdaa8b8a23df7c7f93404b