# VSCode running Task problem

**URL:** <https://forum.crystal-lang.org/t/vscode-running-task-problem/3143>\
**Category:** Help & Support\
**Created:** [April 2, 2021, 8:40am UTC](https://forum.crystal-lang.org/t/vscode-running-task-problem/3143 "2021-04-02T08:40:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![romoxi](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/romoxi/32/1236_2.png) [@romoxi](https://forum.crystal-lang.org/u/romoxi)\
**Post date:** [April 2, 2021, 8:40am UTC](https://forum.crystal-lang.org/t/vscode-running-task-problem/3143/1 "2021-04-02T08:40:59Z")

</div>

Hi,

I try to start my first crystal project with VSCode running on a WindowsSubsystem for Linux (WSL2) with Ubuntu 20.04.

I created a simple taskfile like this: tasks.json

```
{
"version": "2.0.0",
"tasks": [
	{
		"type": "crystal",
		"command": "run",
		"file": "src/main.cr",
		"problemMatcher": [],
		"label": "Crystal: run - src/main",
		"group": {
			"kind": "build",
			"isDefault": true
		}
	}
]
}

```

## Problem A:

When I run this task [Terminal]\>[Run Task…] the code works fine, but the comes the following task error in the output window:

The task provider for “crystal” tasks unexpectedly provided a task of type “shards”.

How can I solve this?

## Problem B:

I also created a launch.json:

```
   "configurations": [
   {
    "preLaunchTask": "Crystal: run - src/main.cr",
    "type": "lldb",
    "request": "launch",
    "name": "Launch",
    "program": "${workspaceFolder}/main",
    "args": [],
    "cwd": "${workspaceFolder}"
   }
  ]

```

With a click on [Run]\>[Run without debugging] there comes up this one:

“unable to find executable for ‘home/udach/projects/rftsim/main/main’”

And in fact, there is no file. I manually buildt the file and moved it to the expected loction and it works fine.

How can I modify the task (from Problem A) to build the file?

Whenever I add something like  
“args”: ["-o main"]  
or even  
“args”: []

a new error comes up:

"There is no task provider registered for tasks of type “crystal”.

Any ideas?

Thanks

Bob

---

<div class="post-metadata">

**Author:** ![bcardiff](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/bcardiff/32/3_2.png) [@bcardiff](https://forum.crystal-lang.org/u/bcardiff)\
**Post date:** [April 10, 2021, 7:38pm UTC](https://forum.crystal-lang.org/t/vscode-running-task-problem/3143/2 "2021-04-10T19:38:03Z")

</div>

Hi Bob,

I am not familiar with vscode & wsl, but I’ve used the following configurations to build and debug from vscode [Debug Crystal in VSCode via CodeLLDB - DEV Community](https://dev.to/bcardiff/debug-crystal-in-vscode-via-codelldb-3lf)

---

<div class="post-metadata">

**Author:** ![Acciaiodigitale](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@Acciaiodigitale](https://forum.crystal-lang.org/u/Acciaiodigitale)\
**Post date:** [April 13, 2021, 7:54am UTC](https://forum.crystal-lang.org/t/vscode-running-task-problem/3143/3 "2021-04-13T07:54:28Z")

</div>

> [@romoxi](#):
>
> ## Problem A:
> 
> When I run this task [Terminal]\>[Run Task…] the code works fine, but the comes the following task error in the output window:
> 
> The task provider for “crystal” tasks unexpectedly provided a task of type “shards”.
> 
> How can I solve this?

This is because some commands included with the plugin use **shards** and not **crystal** as a runner.  
The message is a warning not related to the command you are using.

> [@romoxi](#):
>
> ## Problem B:
> 
> I also created a launch.json:

Actually the plugin has not debug capabilities.

---

<div class="post-metadata">

**Author:** ![romoxi](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/romoxi/32/1236_2.png) [@romoxi](https://forum.crystal-lang.org/u/romoxi)\
**Post date:** [April 15, 2021, 6:44am UTC](https://forum.crystal-lang.org/t/vscode-running-task-problem/3143/4 "2021-04-15T06:44:58Z")

</div>

Thank you for your help.

In my VS-Code there are now the following extensions enabled:

- Remote-WSL (ms-vscode-remote.remote-wsl)
- Crystal Language (crystal-lang-tools.crystal-lang)
- Code Runner (formulahendry.code-runner)

For quick running the code (testing) I can use [Ctr] + [Alt] + [N] or Mouse-Rightclick \> [Run Code]. This uses the Code Runner.

To build the code (for faster execution) I use the command-line.

I disabled any LLDB, launch and task stuff.

Maybe this will help other Newbies.
