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

Bug 311042

Summary: [language support] Variable is not recognized as a "same one"
Product: [WebTools] JSDT Reporter: Eugene Ostroukhov <eostroukhov>
Component: GeneralAssignee: Project Inbox <jsdt.javascript-inbox>
Status: NEW --- QA Contact: Chris Jaun <cmjaun>
Severity: normal    
Priority: P3 CC: cmjaun
Version: 3.2   
Target Milestone: Future   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard: needinfo
Attachments:
Description Flags
Example when those vars are one. none

Description Eugene Ostroukhov CLA 2010-04-29 11:21:18 EDT
(3.2, CVS version)
1. Create a new empty JS file with following contents:
var avar = {};
avar.c = 3;
2. Create another JS file. Verify that avar is visible in this new file.
3. In a new JS file add following line:
avar.b = 3;

Verify that JSDT sees only the "c" property (i.e. the one created in the same file where original class was declared)
Comment 1 Chris Jaun CLA 2010-04-29 15:15:09 EDT
Can you explain why you think it should work that way?

Our general strategy has been to show both. Is that the behavior you see?
Comment 2 Eugene Ostroukhov CLA 2010-05-03 06:35:33 EDT
Created attachment 166761 [details]
Example when those vars are one.

I attached a sample page & two JS files. You can see that the variable is only one.

I acknowledge that these variables _may_ be different in some cases. But I do think that it would be better if JSDT shows proposals for all properties - currently there is no way to see properties of the "local" variable.
Comment 3 Nitin Dahyabhai CLA 2010-12-01 23:19:30 EST
I think we need just a little more info--is the problem that "c" isn't shown in the Outline for the file declaring b?  Maybe we need a screenshot to explain it properly?
Comment 4 Eugene Ostroukhov CLA 2010-12-14 16:43:47 EST
1. In one script file you have:
var a = {};
a.prop1 = 2;

2. In the second script file:
function init()
{
	a.prop2 = "anyval";
	var div = document.getElementById("display");
	div.innerHTML = JSON.stringify(a);
}

If you put cursor after "a.prop2 = "anyval";" and try to code-complete after "a." you will not see prop2 property - only the prop1.

JSONed object still shows this property:
{"prop1":2,"prop2":"anyval"}