| Summary: | All JS code completions are available inside of string literals | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Curtis Windatt <curtis.windatt.public> | ||||||
| Component: | JS Tools | Assignee: | Michael Rennie <Michael_Rennie> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | Michael_Rennie, Olivier_Thomann | ||||||
| Version: | 12.0 | ||||||||
| Target Milestone: | 12.0 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
This appears to be the expected behaviour of Tern. It checks the word end for a prefix. Two things make this worse for Orion 1) We have a lot of templates that fill the completions list 2) We don't run the string completions plugin This will be a problem for module name completion in Tern 18. Created attachment 261272 [details]
Remove templates from string completions
The patch fixes (1) Running the string completions plugin by default would fix (2). This would result in the same behaviour as the Tern demo. If we are concerned about performance of that plug-in we'll have to add our own plug-in (or modification to Tern) to skip calculating proposals as usual. I pushed a different patch for not showing the templates in literals: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=b3e0a5f8fdea1f80faf08aef9b10ffb18ea3e0fb The patch avoids wrapping the code in an if, and treats literals differently depending on their kind, where to allow a template. For example: 1. var foo = /f*/<-- assist here should not show a template since thats where modifiers for the regex literal go 2. var foo = "f"<-- assist here should show a template, the literal is complete 3. var foo = 333<-- assist here should not show a template 4. var foo = true<-- assist here should not show a template After wasting time trying to get the complete_strings plugin up and running - which has the negative effect of stomping on the module name completion - I ended up modifying the Tern code. Fixed in: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=1e91d96d41295054f125bf7a4825e762ae1b35b3 Related Tern bug (and pull request): https://github.com/ternjs/tern/issues/780 |
Created attachment 261263 [details] Screenshot 1) Open JS file 2) Type "fo" (including the quotes) 3) Ctrl+Space to complete Result: See screenshot, for loop completions are offered.