AvinZarlez / processing-vscode

A Visual Studio Code extension for the programming language Processing
https://marketplace.visualstudio.com/items?itemName=Tobiah.language-pde
MIT License
177 stars 25 forks source link

change ${workspaceRoot} to ${fileDirname} in tasks.json #6

Closed clankill3r closed 6 years ago

clankill3r commented 7 years ago

This is just a suggestion. I changed my tasks.json like this:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "run",
            "command": "processing-java",
            "type": "shell",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared"
            },
            "args": [
                "--force",
                "--sketch=${fileDirname}",
                "--run"
            ]
        },
        {
            "taskName": "present",
            "command": "processing-java",
            "type": "shell",
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared"
            },
            "args": [
                "--force",
                "--sketch=${fileDirname}",
                "--present"
            ]
        }
    ]
}

Note that ${workspaceRoot} is changed to ${fileDirname}. I made a workspace of the processing examples folder for example:

screen shot 2017-08-08 at 16 28 34

Now I can just run any example I want without creating a task.json for each example. I also removed the "--output=${workspaceRoot}\\out", It is not needed to run and I prefer to not have those files created in a temp directory instead of in the directory of the pde. I think it would be good to remove this by default.

O yeah, on a mac "--output=${workspaceRoot}\\out" doesn't work anyway. It has to be: "--output=${workspaceRoot}/out" in order to make it work.

AvinZarlez commented 7 years ago

This especially makes sense in your case of opening a workplace with multiple projects. Though I believe you'd still have to have the file you want to run opened to run the task. Which may not be the use case for those who just have one Processing project open in VSCode and may not have any files open when they attempt to run the project?

But perhaps there are more people in the former case than the latter.

Thanks for the tip about the Mac version error! I'm not sure if there is a way to generalize that to work for both/change depending on platform. But removing the folder completely so it outputs to ${fileDirname} would be a solution.

I know for all of my projects I want a separate output folder. I very much dislike my output mixed with my code. Am I more unique in that opinion?

austince commented 6 years ago

I think this might work best as a separate task, say Run Processing File. The Processing IDE's default is to open one sketch at a time and I think we should stick to that.

I do agree about the out folder - I do not generally like one unless I'm building to distribute a project.

AvinZarlez commented 6 years ago

Closing this issue since agreed to keep to "one project at a time"

If for the greater Processing community it makes more sense for the "Default" output to be same folder (rather than an easily git ignorable "out" folder) can make a separate issue.