Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] Re: javascript debug hover.

Hi Johan, 

Actually we do not love the idea of that FakeFiled. FakeField is specific only to JavaScript implementation, and Pavel who was an author of JavaScript support is now off DLTK development. 

Ideally we shall rid that FakeFields off the code. Andrei is now in process of understanding needs of that "entity" and why it was introduced. Please update us if you have a time/understanding how to fix FakeField problems (either eliminating that entity or just with some workarounds for debug hovers)?

Kind Regards,
Andrey

----- Original Message -----
From: "Johan Compagner" <jcompagner@xxxxxxxxx>
To: "DLTK Developer list" <dltk-dev@xxxxxxxxxxx>
Sent: Monday, April 7, 2008 8:29:10 PM GMT +06:00 Almaty, Novosibirsk
Subject: [Dltk-dev] Re: javascript debug hover.


Also it seems that the code assist code never results in anything 
because the parents of the IReferenes are as far as i can see always null 
so it will never result in a FakeField creation 

But also i just see that if that was the case then the FakeField creation should have an extra check: 
because if the reference already know that it is a Function then it shouldn't create a field 
so i guess this is better: 

public void addModelElements(Collection toAdd) { 
if (parent != null) 
{ 
if (isFunctionRef()) 
{ 
toAdd.add(new FakeField(parent, name, offset, length)); 
} 
else 
{ 
// TODO add FakeFunction??? 
} 
} 
} 

public boolean isFunctionRef() { 
return fRef; 
} 


johan 


On Mon, Apr 7, 2008 at 2:49 PM, Johan Compagner < jcompagner@xxxxxxxxx > wrote: 


Hi, 

i am currently debugging the javascript hover part and there are things that go wrong. 
most of them i could fix pretty easy (calculating problems what is really the selection under the mouse and so on) 

But 1 is a bit of a problem, i have this in my script: 

globals.variable = 10; 

when i have that in a watch expression "globals.variable" it is fine. But when i hover over the name. 
Then i just get "Object" this is because the debugger engine gets "variable" and not what should be in the current context "globals.variable" 

I also already know where it goes wrong: JavaScriptSelectionEngine 
private void processMember(ReferenceResolverContext buildContext, 
AssitUtils.PositionCalculator calc, final List result, 
String selection) 

first searches through the code assist code: 

Set resolveGlobals = buildContext.resolveGlobals(selection); 

that does return something but then the loop: 

while (it.hasNext()){ 
IReference r=(IReference) it.next(); 
r.addModelElements(result); 
} 

doesn't add anything because the: 
UncknownReference or/and the TransparanetRef don't have a parent and then a FakeField object will not be added. (it finds 3 of them that are not used after that...) 

then it goes into the search engine with this searchrequestor: 

SearchRequestor requestor = new SearchRequestor() { 

public void acceptSearchMatch(SearchMatch match) 
throws CoreException { 
FieldReferenceMatch mr = (FieldReferenceMatch) match; 
ASTNode nm=mr.getNode(); 
if (nm instanceof VaribleDeclarationReference){ 
VaribleDeclarationReference vm=(VaribleDeclarationReference) nm; 
IReference reference = vm.getReference(); 
if (reference!=null){ 
reference.addModelElements(result); 
} 
} 


} 

}; 
That does find a VaribleDeclarationReference (typo i guess) and that one does have a TransparentRef so a FakeField will be added 
The problem is that VaribleDeclarationReference has exactly the right full name, But its reference doesn't that only holds the last part.. 

So then i come back in the JavascriptDebugHover: 

for (int i = 0; i < resolve.length; i++) { 
IModelElement scriptElement = resolve[i]; 
if (scriptElement instanceof IField) { 
IField field = (IField) scriptElement; 
String snippet = field.getElementName(); 
try { 
IDbgpProperty property = propCmds.getProperty(snippet); 
return getResultText(snippet, ScriptValue.createValue( 
frame, property)); 

that gets the element name of the field which is the last part. And that will be send to the engine. 
that of course wont be right evaluated because it doesn't understand only that part. 

Also if i look at PropertyGetCommand: 

int shName = longName.indexOf('.'); 
if (shName == -1) 
shName = longName.length(); 
String shortName = longName.substring(0, shName); 

it has the notion of a long an short name 
So that side seems to support it just fine. (don't know why it makes a shortName to send that also back but it does) 

so 2 questions, first why is the code assist part done but then completely discarded (at least in this situation) 
where can i change it that i can send the VariableDeclarationReference name instead of the simple name? 
What do you think would be best? 

Because in the end i only want to know 1 thing right? 
Is the current selection under the mouse a Variable or not, and if that is the case then use the complete selection to evaluate it. 

johan 





_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


Back to the top