VSCode 终端 ctrl-click in out of source build 找不到文件 [英] VSCode terminal ctrl-click in out of source build does not find file

查看:39
本文介绍了VSCode 终端 ctrl-click in out of source build 找不到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有一个如下所示的项目目录:

So, I've got a project directory laid out like so:

.vscode/
build/
src/

当我进行外源构建时,我所有的编译器警告&错误指向路径类似 ../src/stuff.cpp:123:4 的文件,带有前导 ../ 因为 GCC 从 构建运行 文件夹.

When I do an out-of-source build, all my compiler warnings & errors point to files with paths like ../src/stuff.cpp:123:4, with a leading ../ because GCC is running from the build folder.

然后当我在 VSCode 中按住 ctrl 单击它时,它很困惑:

Then when I ctrl-click on that in VSCode, it's confused:

我每次都需要手动删除../,以便VSCode找到文件.

I need to manually delete ../ every time, for VSCode to find the file.

是否有我可以调整的 VSCode 设置?

Is there a VSCode setting I can tweak for that ?

推荐答案

我在任务中使用了以下部分

I used the following parts in the task

      "options": {
        "cwd": "${workspaceFolder}/build"
      },
      "problemMatcher": {
        "base": "$gcc",
        "pattern": {
          "regexp": "^../(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "column": 3,
          "severity": 4,
          "message": 5
        }
      },

现在可以在问题"面板中点击错误

Now the errors are clickable in the PROBLEMS panel

这篇关于VSCode 终端 ctrl-click in out of source build 找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆