Skip to content

beginners guide to using extension after installation #100

@abulka

Description

@abulka

Just starting out with crystal and the vscode extension. I am suprised that there is no documentation on how to use the extension after installing it.

Attempting to 'add a configuration' from the vscode debug panel drops down a list of language options, but crystal is not one of them.

Hitting CMD-SHIFT-P (on Mac) then selecting 'configure default build task' lists crystal items in the drop down (yey!) and selecting Crystal Run creates a configuration - however it does not work for me:

        {
            "type": "crystal",
            "command": "run",
            "file": "",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }

After adding ${file} to the "file" entry, the error (when I press CMD SHIFT B to build) is:

Error: The crystal task detection didn't contribute a task for the following configuration:
{
    "type": "crystal",
    "command": "run",
    "file": "${file}",
    "group": {
        "kind": "build",
        "isDefault": true
    }
}
The task will be ignored.

Huh? Presumably all vscode users know about all the tricks with launch.json and tasks.json - however a bit of a guide would be nice, with specific configurations supplied for crystal use. Based on my previous experience with nim tasks in vscode I finally created this:

    "tasks": [
        {
            "label": "Run crystal stuff",
            "type": "shell",
            "command": "crystal",
            "args": ["run", "${file}"],
            "options": {
                "cwd": "${workspaceRoot}"
            },            
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
    ]

which seems to work when I hit CMD-SHIFT-B on my Mac.

Any clarification or improvements on configuations would be gratefully appreciated. My main development experience recently has been Python where I can create launch configurations really easily - the tasks.json approach used by crystal and nim is new territory. Still, I think some getting started instructions would be helpful to newcomers like me. And a default configuration that actually works?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions