Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C-STAT Tasks do not support VSCode built-in variable substitution in JSON config #92

Open
nicklausd opened this issue Jul 30, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@nicklausd
Copy link

Describe the bug
When creating a configuration in tasks.json for a C-STAT Task, the default VSCode variables such as ${workspaceFolder} are not substituted in the arguments.

To Reproduce
Steps to reproduce the behavior:

  1. Create an iar-cstat task configuration in tasks.json
  2. Set the "project" argument to a path using a VSCode variable instead of the default path, such as "${workspaceFolder}/subfolder/Project.ewp"
  3. Run the new task configuration
  4. C-STAT will fail, and the task output will show the following from C-STAT: "ERROR, Failed to open project file: Illegal path "${workspaceFolder}/subfolder/Project.ewp""

Expected behavior
Standard VSCode arguments should be parsed and substituted properly, as they are for the regular IAR Execution tasks. For example, I would expect "${workspaceFolder}" to be expanded to something like "C:/workspaces/ExampleWorkspace" before being passed to C-STAT.

Additional context
I am specifically trying to automate batch clearing the databases followed by C-STAT analysis for 3 different projects in the same workspace without having to manually change the selected project and run each task individually. The plan is to define each clear and run task individually pointing to the correct project file, then creating a task that executes them sequentially, but being unable to use the ${workspaceFolder} variable prevents that from happening in a way that allows me to also share the tasks.json with other members of my team.

If it helps in any way, I tried using my limited JS/TS knowledge to find the root of this, and it seems that it likely comes from the CStatTaskExecution constructor, which calls CommandUtils.parseSettingCommands on each property, and CommandUtils.parseSettingCommands only does its own built-in variable parsing and only on ${command:} variables for the extension, instead of for example the IarExecution which appears to pass the arguments back up to VSCode to do proper substitution on. That's about where my knowledge of VSCode extensions and TypeScript ends though, so my intuition could be wrong on that.

@HampusAdolfsson
Copy link
Collaborator

Thanks for the bug report!

The problem is that the C-STAT tasks are a different type of task than the regular build tasks (a "custom" task rather than a simple process task). For process tasks, all variables are automatically substituted by VS Code, but right now there is no way to do this for custom tasks.

I found some issues asking for an API for substituting variables (e.g. microsoft/vscode#81007 & microsoft/vscode#46471), and it looks like something of the sorts will happen soon. Once that's implemented, this issue can be resolved (and then CommandUtils.parseSettingsCommands shouldn't even be needed).

If it takes too long for the new API to be released I guess we could add a workaround that manually replaces the ${workspaceFolder} variable.

@HampusAdolfsson HampusAdolfsson added the bug Something isn't working label Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants