Repository: vscode
Issue: VSCode .js Debugger Does Not Respect Glob Negations
Labels: bug,debug

Type: <b>Bug</b>

**Reproduction**:
1. Using Windows 11, Turbo repo, and Next.js, have a file with a path of format: `blah\packages\components\navigation\navMenu\index.tsx` whose actual JS maps to `webpack-internal:///packages/components/navigation/navLink/index.tsx` (although this file is definitely not .tsx inside and is definitely vanilla .js)

2. Have a launch.json including:
```jsonc
 // Skip everything (e.g. browser extension js, react internals) except the client files
      "skipFiles": [
        "**/node_modules/**",
        "**/Faker.js UI/**",
        "**/React Developer Tools/**",
        "**/react-devtools-extensions/**",
        "**/webpack-internal:///**",
        "!**/webpack-internal:///**/app/**",
        "!**/webpack-internal:///**/packages/**"
      ],
```

3. Note that the VSCode highlight for skipFiles says, "An array of file or folder names, or path globs, to skip when debugging. Star patterns and negations are allowed, for example, `["**/node_modules/**", "!**/node_modules/my-module/**"]`"

4. Notice how the VSCode debugger stops in the file but with a green highlight instead of a yellow highlight, and when attempting to step into a block / function, the debugger immediately exits the file. (Note that if the negations are removed the exact same green behavior happens.)

![image](https://github.com/microsoft/vscode/assets/14880397/0451b2b5-54de-4c36-8580-8927ab133cb8)

![image](https://github.com/microsoft/vscode/assets/14880397/23eac8a4-0d57-4d65-9ce5-b1925a79f567)


**Expected behavior**:
Remove the
```jsonc
        "**/webpack-internal:///**",
        "!**/webpack-internal:///**/app/**",
        "!**/webpack-internal:///**/packages/**"
```
lines and restart VSCode instance and debugging browser and notice how debugging is now properly working.

---
Full `launch.json`
<details>

```jsonc
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "server-web",
      "type": "node-terminal",
      "request": "launch",
      "command": "yarn run dev",
      "cwd": "${workspaceFolder}/apps/web",
      "presentation": { "group": "web", "hidden": true }
    },
    {
      "name": "client-web",
      "type": "msedge",
      "request": "attach",
      "port": 1337,
      // Ideally we could skip everything (e.g. browser extension js, react internals) except the client files.
      // "skipFiles": [
      // "**/node_modules/**",
      // "**/Faker.js UI/**",
      // "**/React Developer Tools/**",
      // "**/react-devtools-extensions/**",
      // "**/webpack-internal:///**",
      // "!**/webpack-internal:///**/app/**",
      // "!**/webpack-internal:///**/packages/**"
      // ]
      // But I'm not sure how to do that yet. Glob negations seem to be bugged. - Stan
      "skipFiles": [
        "**/node_modules/**",
        "**/Faker.js UI/**",
        "**/React Developer Tools/**",
        "**/react-devtools-extensions/**"
      ],
      "webRoot": "${workspaceFolder}/apps/web",
      "url": "http://localhost:3001",
      "presentation": { "group": "web", "hidden": true }
    },
    {
      "name": "server-auth",
      "type": "node-terminal",
      "request": "launch",
      "command": "yarn run dev",
      "cwd": "${workspaceFolder}/apps/auth",
      "presentation": { "group": "auth", "hidden": true }
    },
    {
      "name": "client-auth",
      "type": "msedge",
      "request": "attach",
      "port": 1337,
      "webRoot": "${workspaceFolder}/apps/auth",
      "url": "http://localhost:3003",
      "presentation": { "group": "auth", "hidden": true }
    },
    {
      "name": "server-payments",
      "type": "node-terminal",
      "request": "launch",
      "command": "yarn run dev",
      "cwd": "${workspaceFolder}/apps/payments",
      "presentation": { "group": "payments", "hidden": true }
    },
    {
      "name": "client-payments",
      "type": "msedge",
      "request": "attach",
      "port": 1337,
      "webRoot": "${workspaceFolder}/apps/payments",
      "url": "http://localhost:3002",
      "presentation": { "group": "payments", "hidden": true }
    },
    {
      "preLaunchTask": "Start Storybook",
      "name": "storybook",
      "type": "msedge",
      "request": "attach",
      "port": 1337,
      "webRoot": "${workspaceFolder}",
      "url": "http://localhost:6006/"
    }
  ],
  "compounds": [
    {
      "name": "web",
      "configurations": ["server-web", "client-web"],
      "stopAll": true,
      "presentation": { "order": 1 }
    },
    {
      "name": "auth",
      "configurations": ["server-auth", "client-auth"],
      "stopAll": true,
      "presentation": { "order": 3 }
    },
    {
      "name": "payments",
      "configurations": ["server-payments", "client-payments"],
      "stopAll": true,
      "presentation": { "order": 2 }
    }
  ]
}
```

</details>


---

VS Code version: Code 1.85.2 (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:10.514Z)
OS version: Windows_NT x64 10.0.22631
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|12th Gen Intel(R) Core(TM) i7-12800H (20 x 2803)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|undefined|
|Memory (System)|63.67GB (35.53GB free)|
|Process Argv|--disable-extensions --crash-reporter-id afa830bf-a37b-422a-bdb0-58b147fe3168|
|Screen Reader|no|
|VM|0%|
</details>Extensions disabled<details>
<summary>A/B Experiments</summary>

```
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
vscrpc:30673769
0bi6i642:30951795
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementst:30887150
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
dsvsc019bcf:30953938
3ef8e399:30949928

```

</details>

<!-- generated by issue reporter -->