| Summary: | Finder.findNode does not find correct node for ClassDeclaration and other identifiers inside classes | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Curtis Windatt <curtis.windatt.public> |
| Component: | JS Tools | Assignee: | Curtis Windatt <curtis.windatt.public> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 12.0 | ||
| Target Milestone: | 12.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=50e7bb127daf0f68bb1e5ec40bf4531b830e67e5 Fixed in master with both occurrences tests and finder tests The problem is that Class and Method Declarations include the {} curly braces in the range of their bodies (whereas Function Expressions do not include the {} in the range of their block statements). I originally put a check into occurrences for this, but this would only work in the editor, not in the tests. When the parent node is added by eslint the parent is right, but when we depend on finder to add the parents array it gets it wrong. The fix I pushed in modifies Finder.findNode() to select the identifier node when the offset is touching both identifier and body. |
class a{} If you put the cursor between 'a' and '{' Finder.findNode in occurrences will not return the identifier node. Instead the class body is returned. Same for class expressions var a = class b{} and method declarations class a{ f(){} } But it works for function expressions var a = function f1(){ function f2(){} }