[ISSUE] Jump to error in code does not work

After compiling my project, going through the list of warnings and errors trying to jump to any of them does not work. The IDE complains about missing source file. The reason seem to be an incorrect composition of the source file name: it repeats the directory part of the source twice before the name of the file:

"Unable to open xyz.cpp: file not found"
(file:///d:/source/ParticleProjects/ProjectX/d:/Source/ParticleProjects/ProjectX/src/xyz.cpp)

Environment information:

"VSCode version": "1.32.3"
 "os": "windows",
 "type": "Windows_NT",
 "release": "10.0.17763",
 "arch": "x64",

  "extensions": [
        {
            "id": "ms-vscode.node-debug",
            "version": "1.32.4"
        },
        {
            "id": "ms-vscode.node-debug2",
            "version": "1.32.0"
        },
        {
            "id": "ms-vscode.references-view",
            "version": "0.0.26"
        },
        {
            "id": "donjayamanne.githistory",
            "version": "0.4.6"
        },
        {
            "id": "eamodio.gitlens",
            "version": "9.5.1"
        },
        {
            "id": "EditorConfig.EditorConfig",
            "version": "0.13.0"
        },
        {
            "id": "Equinusocio.vsc-material-theme",
            "version": "2.8.2"
        },
        {
            "id": "marus25.cortex-debug",
            "version": "0.2.3"
        },
        {
            "id": "ms-python.python",
            "version": "2019.2.5558"
        },
        {
            "id": "ms-vscode.cpptools",
            "version": "0.22.1"
        },
        {
            "id": "ms-vsts.team",
            "version": "1.149.2"
        },
        {
            "id": "particle.particle-vscode-core",
            "version": "1.2.2"
        },
        {
            "id": "particle.particle-vscode-pack",
            "version": "1.2.2"
        },
        {
            "id": "particle.particle-vscode-snippets",
            "version": "1.2.2"
        },
        {
            "id": "particle.particle-vscode-theme",
            "version": "1.2.2"
        },
        {
            "id": "felipecaputo.git-project-manager",
            "version": "1.7.1"
        }
    ]
1 Like

I see the same issue.

I think the problem is that the $gcc problem matcher uses

"fileLocation": ["relative", "${workspaceFolder}"],

but the particle local build reports absolute paths:

/Users/me/Code/particle.io/ProjectX/src/MyClass.cpp: In constructor 'MyClass::MyClass()':
/Users/me/Code/particle.io/ProjectX/src/MyClass.cpp.cpp:14:2: error: 'x' was not declared in this scope

and this then creates the wrong path by appending the absolute path to the workspace root:

Unable to open 'MyClass.cpp': File not found (file:///Users/me/Code/particle.io/ProjectX/Users/me/Code/particle.io/ProjectX/src/MyClass.cpp).

I found a workaround by configuring the build task by :

And then change the problem matcher to:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558 
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "particle",
            "name": "Compile application (local)",
            "problemMatcher": [
                {
                    "base": "$gcc",
                    "fileLocation": "absolute"
                }
            ]
        }
    ]
}

With this now the problems will have the correct path.
This needs to be done for each project so I think the particle extension should change or differently configure the problemMatcher for the predefined “Compile application (local)” task.

2 Likes

ah, nice one - thanks :pray:

i’ll get this added to the next release :+1:

Great! Works fine. Thanks