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

Can't use ${selectedText} as a optional variable for Tasks #117121

Closed
MohitGhodasara opened this issue Feb 20, 2021 · 2 comments
Closed

Can't use ${selectedText} as a optional variable for Tasks #117121

MohitGhodasara opened this issue Feb 20, 2021 · 2 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s)

Comments

@MohitGhodasara
Copy link

  • VS Code Version: 1.53.2
  • OS Version: Ubuntu 18.4 LTS

I want to create a task that takes either from the selected text or asks for input. something like this

{
  "label": "Blah Blah",
  "type": "shell",
  "command": "echo ${selectedText} || ${input:get-string}",
  "problemMatcher": [],
  "group": "build",
}

but it throws error when text is not selected

Variable ${selectedText} can not be resolved. Make sure to have some text selected in the active editor.

is it possible to get seleted text lenght that we can check conditionally? ${seletedTextLenght} == 0
or by default ${selectedText} return empty string? ${selectedText} == ''

@ArturoDent
Copy link

See #92854 and #94060

@alexr00
Copy link
Member

alexr00 commented Feb 22, 2021

Thanks for linking @ArturoDent . Duplicate of #92854, since that's how we'd solve this problem.

@alexr00 alexr00 closed this as completed Feb 22, 2021
@alexr00 alexr00 added the *duplicate Issue identified as a duplicate of another issue(s) label Feb 22, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

3 participants