VSCode .js Debugger Does Not Respect Glob Negations

sdnqo3pr  于 3个月前  发布在  Vscode
关注(0)|答案(8)|浏览(50)

类型:Bug

重现步骤:

  1. 使用Windows 11、Turbo repo和Next.js,创建一个路径格式为:blah\packages\components\navigation\navMenu\index.tsx的文件,其实际JSMap到webpack-internal:///packages/components/navigation/navLink/index.tsx(尽管此文件绝对不是.tsx文件,而是纯.js文件)
  2. 创建一个包含以下内容的launch.json文件:
// 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/**"
      ],
  1. 注意VSCode的skipFiles高亮显示为:“调试时跳过的文件或文件夹名称、路径通配符数组。可以使用星号模式和否定符号,例如:["**/node_modules/**", "!**/node_modules/my-module/**"]”。
  2. 注意当尝试逐步进入代码块/函数时,调试器会立即退出文件,而不是绿色高亮显示。(注意,如果删除否定符号,将发生完全相同的绿色行为。)

预期行为:
删除

"**/webpack-internal:///**",
        "!**/webpack-internal:///**/app/**",
        "!**/webpack-internal:///**/packages/**"

行并重新启动VSCode示例和调试浏览器,观察调试现在是否正常工作。
完整的
launch.json

{
  "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 }
    }
  ]
}

VS Code版本:Code 1.85.2 ( 8b37750 , 2024-01-18T06:40:10.514Z)
操作系统版本:Windows_NT x64 10.0.22631
模式:
系统信息
| 项目 | 值 |
| ------------ | ------------ |
| CPUs | 12th Gen Intel(R) Core(TM) i7-12800H (20 x 2803) |
| GPU状态 | 2d_canvas:启用canvas_oop_rasterization:启用_ondirect_rendering_display_compositor:禁用_off_okgpu_compositing:启用multiple_raster_threads:启用_onopengl:启用_onrasterization:启用raw_draw:禁用_off_okvideo_decode:启用video_encode:启用vulkan:禁用_offwebgl:启用webgl2:启用webgpu:启用 |
| 负载(平均) | undefined |
| 内存(系统) | 63.67GB (35.53GB可用) |
| 进程参数 | --disable-extensions --crash-reporter-id afa830bf-a37b-422a-bdb0-58b147fe3168 |
| 屏幕阅读器 | 无 |
| VM | 0% |扩展名禁用A/B实验

91zkwejq

91zkwejq1#

感谢您提出这个问题!看起来您可能正在使用旧版本的VS Code,最新稳定版本是1.86.0。请尝试升级到最新版本并检查此问题是否仍然存在。
快乐编码!

2j4z5cfb

2j4z5cfb2#

感谢您提出这个问题!看起来您可能正在使用旧版本的VS Code,最新稳定版本是1.86.0。请尝试升级到最新版本并检查此问题是否仍然存在。
快乐编码!

yhuiod9q

yhuiod9q3#

可能重复的问题 #203408 ,请尝试使用夜间构建。

c6ubokkw

c6ubokkw4#

@connor4312 我尝试了夜间模式,问题仍然存在。我注意到它发生在事件处理程序中,但当我在事件监听器之外设置断点时,我并不总是得到绿色高亮。它似乎在其他地方正常中断。

s2j5cfk0

s2j5cfk06#

请按照以下指示收集跟踪日志:
如果您能够,请将 "trace": true 添加到您的 launch.json 并重现该问题。磁盘上日志文件的位置将写入调试控制台。请与我们分享。
⚠️此日志文件不包含源代码,但将包含文件路径。您可以将其放入 https://microsoft.github.io/vscode-pwa-analyzer/index.html 中查看其内容。如果您不想公开共享日志,可以将其发送至 connor@xbox.com

eqzww0vc

eqzww0vc7#

已通过电子邮件发送。

ws51t4hk

ws51t4hk8#

嘿,@connor4312,这个问题可能需要进一步关注。
@Stan-Stani,如果你发现问题已经不存在了,你可以帮我们关闭这个问题,或者提供更多的信息。

相关问题