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

Bug 458673

Summary: Improve "add to globals" quick fix
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Michael_Rennie
Version: 7.0   
Target Milestone: 8.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2015-01-28 13:27:49 EST
1. Create a js file containing this code:
foo++;

2. You'll see an error: "foo is undefined", and a quick fix "Add to globals directive". Use the quick fix.

3. Now you get:
/*globals foo*/
foo++;

4. The code still has an error in the same spot: "foo is readonly". There is no quick fix.


I think the "Add to globals" fix needs to mark the global as writable ( /*globals foo:true*/ ) when it's fixing an assigment reference. Otherwise, the quick fix appears to have failed, since you immediately see an error in the same spot after using it.
Comment 1 Michael Rennie CLA 2015-01-29 12:56:09 EST
Good suggestion Mark. I agree that our fixes should completely resolve a problem rather than fixing one and presenting the user with another.

Fix + tests:
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=f98d3f246ed8f81ad12640fe07917f0b2f7131d7