oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.21k stars 2.77k forks source link

[VSCode] Debugger does not show module level variables #14242

Open elemental-mind opened 1 month ago

elemental-mind commented 1 month ago

What version of Bun is running?

1.1.30-canary.71+af82a446d, VSCode Extension Version v0.0.15

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

  1. Create a simple file containing a module level variable. For example:
    
    const moduleLevelVariable = 1000;

console.log(moduleLevelVariable);


2. Set a breakpoint after the variable is set
3. Launch the debugger
3. Check the variables displayed in the "variables" tab in the debugger dialogue

### What is the expected behavior?

Module variables should be displayed in the "variables" tab.

In the example given, `moduleLevelVariable` should be displayed with a value of 1000.

### What do you see instead?

The variable `moduleLevelVariable` does not get displayed. It also does not appear under the "Globals" group.

![image](https://github.com/user-attachments/assets/60ad6807-f0b7-42f7-884f-7e2b4566e545)

### Additional information

_No response_
tal commented 1 month ago

i have the same issue

Soarex16 commented 1 month ago

The problem occurs both in debuggers based on Debug Adapter (tested on WebStorm, logs) Image and in the WebKit debugger (debug.bun.sh) Image It looks like the problem is somewhere in the runtime itself, because I checked the same example in Safari and the variable is displayed there. Image