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

Bug 473777

Summary: Fuzzy case matching for content assist
Product: [ECD] Orion Reporter: John Arthorne <john.arthorne>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, gujiman, Michael_Rennie
Version: unspecified   
Target Milestone: 10.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description John Arthorne CLA 2015-07-28 14:50:20 EDT
Sample script:

  var x = [1, 2, 3];
  x.fore

I would expect content assist to offer "forEach" as an expansion of "fore", but it does not.
Comment 1 Curtis Windatt CLA 2015-07-28 16:03:37 EDT
Two cases:
1) If you type 'fore', then hit ctrl-space, Tern returns no completions.  We never get to the looselyMatches check.
2) If you type 'f', hit ctrl-space, Tern returns several completions.  Continuing to type 'ore' will result in all proposals being filtered.  This is because the filtering is handled by the editor's content assist, which has no loose match checking.  I had a similar problem in HTML when '<' is typed with content assist open, which I worked around by not including the '<' in the prefix.
Comment 2 Curtis Windatt CLA 2015-07-28 16:18:41 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=1c7e7ef7331c62b042dc23b51448bc69c42173d8
Fixed case 1 in master.  Tern needs a flag passed in to return caseInsensitive proposals.  There is no support for camelcase matches, though if no proposals are found, Tern will use some heuristics to guess at potential properties.
Comment 3 Michael Rennie CLA 2015-07-28 16:34:29 EDT
(In reply to Curtis Windatt from comment #2)
> http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/
> ?id=1c7e7ef7331c62b042dc23b51448bc69c42173d8
> Fixed case 1 in master.  Tern needs a flag passed in to return
> caseInsensitive proposals.  There is no support for camelcase matches,
> though if no proposals are found, Tern will use some heuristics to guess at
> potential properties.

Thanks for pushing that part of the fix Curtis, here is the remainder and tests:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=749fff7d89892efb506faa0ffd865cfdb4dc0cb5
Comment 4 Curtis Windatt CLA 2015-07-28 16:37:51 EDT
Mike said he is making other changes in this area.

I opened Bug 473787 to track the second case, which is really an issue with editor content assist, not JS tools.
Comment 5 guji muun CLA 2015-09-06 22:42:56 EDT
i had a similar problem that i managed to fix it:

open the file 'contentAssist.js' and search and replace the following 4 lines of code:

search:       proposalString.indexOf(prefixText + this._filterText)
replace with: proposalString.toLowerCase().indexOf(prefixText.toLowerCase() + this._filterText.toLowerCase())

search:       proposal.name.indexOf(prefixText + this._filterText)
replace with: proposal.name.toLowerCase().indexOf(prefixText.toLowerCase() + this._filterText.toLowerCase())

search:       proposal.proposal.indexOf(this._filterText)
replace with: proposal.proposal.toLowerCase().indexOf(this._filterText.toLowerCase())

search:       proposal.indexOf(this._filterText)
replace with: proposal.toLowerCase().indexOf(this._filterText.toLowerCase())


What i have done here is told contentAssist to read what i have typed in to lower case and search fo proposals in lower case.