owenfarrell / vscode-microtask

MIT License
1 stars 0 forks source link

VS Code variables don't work? #1

Open mbomb007 opened 4 years ago

mbomb007 commented 4 years ago

https://code.visualstudio.com/docs/editor/variables-reference

I can't get this extension to work. I am using tasks with variables, like this one:

    {
      "label": "PHP: CodeSniff Folder",
      "type": "shell",
      "command": "${config:phpcs.executablePath}",
      "args": [
        "--standard=${config:phpcs.standard}",
        "--extensions=module,inc,install,php,theme,test,js,css",
        "--report=csv",
        "--basepath=${cwd}",
        "${cwd}"
      ],
      "options": {
        "cwd": "${workspaceFolder}"
      },
      "problemMatcher": {
        "owner": "php",
        "fileLocation": [
          "relative",
          "${workspaceFolder}"
        ],
        "pattern": {
          "regexp": "^\"(.*?)\",(\\d+),(\\d+),(error|warning),\"(.*)\",.*$",
          "file": 1,
          "line": 2,
          "column": 3,
          "severity": 4,
          "message": 5
        }
      }
    }

If I just run a similar task with the current working directory hardcoded, it works, running the following in my PowerShell terminal:

vendor/squizlabs/php_codesniffer/bin/phpcs -n --standard=vendor/drupal/coder/coder_sniffer/Drupal,vendor/drupal/coder/coder_sniffer/DrupalPractice --extensions=module,inc,install,php,theme,test,js,css --report=csv --basepath=C:\Projects\my_project sites/all/modules/custom

But if I try using the task above in conjunction Microtask, it just prints the following in the Output window:

> Executing task: ${config:phpcs.executablePath} --standard=${config:phpcs.standard} --extensions=module,inc,install,php,theme,test,js,css --report=csv --basepath=${cwd} ${cwd} <
owenfarrell commented 4 years ago

Hi @mbomb007,

You're absolutely right, those kinds of dynamic expressions aren't currently supported. When I originally wrote this extensions, there was no API to pull Task information - so I was resigned to loading the configuration myself.

Now that there is an API, this should be possible. And there's a good amount of code that can probably come out of the extension as a result.

I'll start sketching this out shortly and will give you a shout when I need some assistance testing the updates.

Thanks for raising this!

~Owen

mbomb007 commented 4 years ago

I see a pull request. Is the fix ready to be merged, or is there a reason you are waiting?