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

ignore workspaceFolder error #78

Closed
dvirtz opened this issue Jan 29, 2024 · 4 comments
Closed

ignore workspaceFolder error #78

dvirtz opened this issue Jan 29, 2024 · 4 comments
Assignees

Comments

@dvirtz
Copy link

dvirtz commented Jan 29, 2024

I have several multi-root projects that have one shared folder and one folder which is unique to each project, so

project-1:               project-2:               project-3:
|- folder a              |- folder a              |- folder a
|- folder b.1            |- folder b.2            |- folder b.3

etc.
I want to have a task in the shared folder that gets the name of the unique folder so I apply a JavaScript expression that returns the first valid of ${workspaceFolder:b.1}, ${workspaceFolder:b.2}, ${workspaceFolder:b.3}, etc.
This works but there's annoying Workspace not found with name notifications popping up.

Can you add an option to ignore those errors or can you think of a better way to achieve this?

@rioj7 rioj7 self-assigned this Jan 30, 2024
@rioj7 rioj7 closed this as completed in 200f9a7 Jan 30, 2024
@rioj7
Copy link
Owner

rioj7 commented Jan 30, 2024

@dvirtz try v1.61.1 and use

${workspaceFolder:b.1:nomsg}
${workspaceFolder:b.2:nomsg}
${workspaceFolder:b.3:nomsg}

I'm curious about the JavaScript expression that you use? Do you do it in the tasks.json file or in the script that is started by the task?

@dvirtz
Copy link
Author

dvirtz commented Jan 31, 2024

Thanks @rioj7, that works.
The input variable I use is

{
  "id": "uniqueFolder",
  "type": "command",
  "command": "extension.commandvariable.config.expression",
  "args": {
    "configVariable": "editor.fontSize",
    "expression": "['${workspaceFolder:b.1:nomsg}', '${workspaceFolder:b.2:nomsg}', '${workspaceFolder:b.3:nomsg}'].find(folder => folder != 'Unknown')",
  }
}

in tasks.json.
I hack config.expression for that. I couldn't find a better way to just run some JS expression with variable expansion.

@rioj7
Copy link
Owner

rioj7 commented Feb 1, 2024

@dvirtz Users always find creative application of features.

I will add this to the README as a possible use case of variables.

I will make the configVariable property optional.

@rioj7
Copy link
Owner

rioj7 commented Feb 11, 2024

@dvirtz in v1.61.2 configVariable property is optional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants