PIO, VSC can't build, no tasks found

I’m running VSC 1.40.0 and PIO 1.9.3 is shown as enabled. (But the PIO home tab shows Home 3.0.0 Core 4.1.0. Not sure how they relate…)

But, when I open an old project or create a new on and attempt to build or upload to the target device a popup say no tasks available is displayed.

Since I never created task before I have no idea why they went missing or how to get them back. :thinking:

I only found one post about this issue, but it was marked solved by upgrading to the latest revision available at that point in time…a version which is now an old revision.

The “Home” and “Core” components of PlatformIO have different version numbers than the PIO VSCode extension itself, that’s perfectly ok there.

Can you open a PIO terminal? Does executing the command

pio init --ide=vscode

then closing VSCode and reopening it fix the problem?

Thanks!

Opening the terminal, executing that command:

The current working directory /home/mac/Documents/PlatformIO/Projects/Electrol_New_Brains-2 will be used for the project.

The next files/directories have been created in /home/mac/Documents/PlatformIO/Projects/Electrol_New_Brains-2
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File

Project has been successfully updated including configuration files for `vscode` IDE.

But restarting VSC gets same error: No task to run found. Configure Tasks…

Huh. Can you copy-paste the contents of the file /home/mac/Documents/PlatformIO/Projects/Electrol_New_Brains-2/.vscode/tasks.json here? (.vscode is a hidden folder)

task.json does not exist in that folder.

In fact, there is no file tasks.json anywhere recursively from /home/mac/Documents/PlatformIO/…

I have the same problem and also, as drmacro I don’t have any tasks.json file in the .vscode directory. I think this happened when VSCode upgraded itself to 1.40.0.

Maybe ivankravets has an idea on how to solve this?

Any ideas? Thanks in advace.

What are the contents of that folder? Is it completely empty? Which VSCode did this work previously on?

The other contents:

c_cpp_properties.json
extensions.json
launch.json

As for what version it worked…the folder was created in September. I hadn’t worked on the code since. But, I don’t know what the rev was then…it did compile and upload fine then though.

Oh actually there isn’t supposed to be a task.json there, it’s not generated by PIO. The templates are about these 3 files you’ve mentioned. https://github.com/platformio/platformio-core/tree/develop/platformio/ide/tpls/vscode/.vscode

So the VSCode error message seems to indicate that task.json is missing although requiered.

So maybe downgrading to VSCode 1.39 is a workaround for now, while @ivankravets investigates how that error comes to be since 1.40?

What is your OS? It seems like VSCode issue.

In my case, the info is:

Version: 1.40.0
Commit: 86405ea23e3937316009fc27c9361deee66ffbf5
Date: 2019-11-06T18:14:08.920Z
Electron: 6.1.2
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Linux x64 5.0.0-32-generic

And I also have the three files in .vscode

c_cpp_properties.json
extensions.json
launch.json

We can’t reproduce this issue on Linux machine. Could you try to uninstall/install VSCode? No need to reinstall PlatformIO. Just VSCode.

Unfortunatelly it didn’t work. I did:

sudo apt remove code
sudo apt install code

But i got the same problem. Thank you again.

Should I purge VSCode? (I think I just did a standard uninstall)

UPDATED: I uninstall VSCode with purge, but I still get the same problem.

Also, if I do right-click on the file and select “Build and Debug active file”, I get the following (image)

I started getting the same thing, the ‘no task to run found. Configure tasks’, after VS Code told me to click on a ‘disable typescript it’s running too slow’ button.

All we need is a sample tasks.json file to get back up and running, please can someone post the content of their tasks.json. I went through the source but it’s not in there so I’m guessing it’s automatically generated.

1 Like

Are the tasks in the PIO task explorer also non-working for you? Because that’s the equivalent with which you usually work in the VSCode extension. Just as the docs show.

Thanks, but mine doesn’t look like quite like that, I just get the boilerplate list of tasks, clicking on any gives the same message as [lcerda] posted above (no task to run found…). There’s nothing like the extra fields shown in the link you posted.

Tried:

  • Adding the template as VSCode suggests (no change).
  • Uninstall VSCode and reinstall (no change).

Will now try - uninstall VSCode, find all instances of .vscode buried in local settings etc. then another re-install.

Still think if someone could post their tasks.json it would fix this pretty quick.

If you get a popup saying ‘disable java for typescript’ just don’t press it!! The setting to reverse this is hidden deep within some settings file that persists between uninstalls which you can’t get to through normal means. But that’s academic - anyone here has found this after clicking on it.

After the next uninstall/reinstall cycle if I find any buried setting I’ll repost.

Here’s what my tasks.json looks like:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "type": "npm",
            "script": "build",
            "problemMatcher": []
        }
    ]
}

Tried:

  • Uninstall VSCode.
  • Purge all found keys in registry and in appdata folder.
  • Remove all .vscode, .platformio in users area
  • Reinstall VSCode
  • Reinstall PlatformIO.

Still get

Any further ideas? Could we see what a ‘healthy’ tasks.json looks like? Is there any link - I’ve tried exhaustive searching but it seems there’s no example.

EDIT: further searching reveals that VSCode creates a private registry. Could this be the source of the errors?

I finally could “fix” it… I downgraded VSCode to the previous version (1.39.2). I just followed these instructions: visual studio code - How to downgrade vscode - Stack Overflow

It is defintely not good, because I also think there is a problem with the “disable java for typescript” (as Cryptocacher mentioned too), since every time I do a build, upload or even a monitor, my cores go wild for 20 secs (or so) and just then it starts doing the actual job. And I think it is related to the typescript thing. Anyways, now it working (although slowly) again.

I also managed to fix by a different method.

  • cleaned python installs (had quite a few different versions installed), and updated to the latest 3.80
  • re-installed platformIO.
  • removed all projects from the workspace
  • closed workspace, started a new workspace and added the previous projects.

Now I have a much cleaner VS Code install the syntax colouring and auto-formatting are working a lot better. Sorry this isn’t definitive, but at least I didn’t need to install the tasks.json file.
your .vscode folder in the project folder shouldn’t contain any tasks.json either.

So - I think there could be settings in the workspace which affect this. Try making a new workspace.

1 Like