SchoofsKelvin / vscode-sshfs

Extension for Visual Studio Code: File system provider using SSH
GNU General Public License v3.0
543 stars 36 forks source link

"No build task to run found" for ".vscode/tasks.json", but tasks on "workspace.json" works #263

Closed juliannojungle closed 2 years ago

juliannojungle commented 3 years ago

I'm running vscode in windows 10 x64, using sshfs extension to connect a Raspberry Pi Zero W (armv6l, not supported by Microsoft's Remote SSH) running "Raspberry Pi OS". To connect, I use the following config:

    "sshfs.configs": [
        {
            "name": "myproject",
            "host": "raspberrypi",
            "root": "/home/pi/git/myproject",
            "username": "pi",
            "privateKeyPath": "c:\\users\\myuser\\.ssh\\id_rsa"
        }
   ]

When clicking on Add as Workspace folder button, the project is loaded correctly, the project folder is opened by vscode and the myproject/.vscode/tasks.json file is present.

Then I press ctrl+shift+b to build but vscode shows the No build task to run found. Configure Build Task... message.

If I press ctrl+shift+p, select Preferences: Open Workspace Settings (JSON) and add the task there (like below sample), then it gets listed when pressing ctrl+shift+b and everything works fine.

{
    "folders": [
        {
            "name": "SSH FS - myproject",
            "uri": "ssh://myproject/"
        }
    ],
    "settings": {},
    "tasks": {
        "version": "2.0.0",
        "tasks": [
            {
                "label": "SSH FS: myproject build && run",
                "group": "build",
                "type": "ssh-shell",
                "host": "myproject",
                "options": {
                    "cwd": "${remoteWorkspaceFolder}"
                },
                "command": "g++ -g ./sample.cpp -o sample && ./sample",
                "problemMatcher": [],
                "presentation": {
                    "reveal": "always",
                    "showReuseMessage": false,
                    "panel": "shared",
                    "clear": true
                }
            }
        ]
    }
}

The task from tasks.json file got listed randomly a couple times (and worked fine), but as soon I closed vscode and reopened (or just disconnect and reconnect sshfs), it's gone again.

SchoofsKelvin commented 3 years ago

Might be that VS Code doesn't pick up the tasks.json, or maybe tries to pick it up too early. The extension should delay file reads while still connecting, but maybe I missed something. I'll try to reproduce this when I have time and see how I can fix it.