vshaxe / hashlink-debugger

Visual Studio Code Debugger for Haxe/HashLink applications
https://hashlink.haxe.org/
MIT License
57 stars 23 forks source link

Debugger issue : Unknown variables with local functions #104

Closed Fl0xer closed 3 months ago

Fl0xer commented 2 years ago

When we are hovering the variables, the tooltip shows "Unknown variable" instead of the value of this variable.

inovento commented 2 years ago

In the following example:

class DebuggerTest extends flash.display.Sprite { private var obj:flash.display.Sprite;

public function new() {
    super();
    obj = new flash.display.Sprite();
    obj.x = 100;
    trace(obj.x);
}

}

Hovering over obj.x reports "Unknown variable".

Is it the intended behavior or it's not supposed to happen? Is there any workaround or specific combination of versions of VS Code/Haxe/Hash Link Debugger that this works as expected?

ncannasse commented 2 years ago

You're using flash API so I don't think that's HashLink debugger you're using here ?

inovento commented 2 years ago

@ncannasse This is https://github.com/openfl/openfl + https://github.com/haxelime/lime Using HashLink Debugger indeed. In what conditions is it working for you?

inovento commented 2 years ago

Here is a very simple working example with all references to flash (openfl) omitted to eliminate any confusion and possibly any collisions with other libraries:

class DebuggerTest { private var obj:Simple;

public function new(root:Any) {
    obj = new Simple();
    obj.x = 100;
    trace(obj.x);
}

}

class Simple { private var _x:Int;

public function new() {}

public var x(get, set):Int;
private function get_x():Int {
    return _x;
}
private function set_x(value:Int):Int {
    _x = value;
    return get_x();
}

}

Hovering on obj.x displays "Unknown variable". Tested with Haxe 4.1.5, HashLink Debugger v1.1.2, VS Code 1.6.5 and Hash Link 1.9.0, 1.10.0, 1.11.0.

yuxiaomao commented 3 months ago

Cannot reproduce with your last example. Haxe development build (5.0.0-https://github.com/HaxeFoundation/haxe/commit/7b92f74fc60f0f90403cd9414837605c90857027), Hashlink Debugger master (1.4.17), Hashlink master (1.15).

Also, inspect inlined variable support have been added to the debugger and requires haxe's development build support.

Please give us more details if it always fail for you.