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

Add selected text to configuration variable #27466 #39483

Merged
merged 1 commit into from
Dec 22, 2017

Conversation

yitongding
Copy link
Contributor

Add ${selectedText} configuration variable to tasks.json and launch.json, proposed in issue #27466

@msftclas
Copy link

msftclas commented Dec 3, 2017

CLA assistant check
All CLA requirements met.

@isidorn
Copy link
Contributor

isidorn commented Dec 4, 2017

Thanks for the pr, however this week we are wrapping up our milestone which means I will review this PR start of next week.

@dbaeumer fyi

@isidorn isidorn self-assigned this Dec 4, 2017
@isidorn isidorn added this to the December 2017 milestone Dec 4, 2017
@isidorn
Copy link
Contributor

isidorn commented Dec 12, 2017

Looking at the original issue I am not so convinced this is needed in our core. What is the big use case scenario that could profit from this PR?
Since none of the debug users asked for this afaik I am assigning to @dbaeumer so he can decide if this is good to have or not wrt to the tasks.json.

@isidorn isidorn removed this from the December 2017/January 2018 milestone Dec 12, 2017
@isidorn isidorn assigned dbaeumer and unassigned isidorn Dec 12, 2017
@dbaeumer
Copy link
Member

@yitongding I agree with @isidorn. Can you please outline in which cases a selected text is needed for tasks ?

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Dec 13, 2017
@yitongding
Copy link
Contributor Author

@dbaeumer @isidorn Hi, thanks for reviewing!

Here is my use case for selected text:

As a frontend developer, I use a e2e test framework called nightwatch. When running the test, there is an option to choose which test case in the current test file I would like to run. So the command will be like nightwatch --test header.js --testcase 'should render'.

Currently, I use task.json to run the test with arg: ['--test', '${file}']. However, this will run the whole test file, and sometimes it could takes very long time before the test case I really care gets to run. With arg: ['--test', '${file}', '--testcase', '${selectedText}'], I'll be able to run the target text case only by selecting the test case title.

Hopefully, I made my self clear 😄

@dbaeumer
Copy link
Member

@yitongding thanks for the example. This makes sense to me.

@roman-petrov
Copy link

@dbaeumer, actually, I see almost the the same case with running Karma tests in our project, that's why I voted for this issue.

@dbaeumer
Copy link
Member

@isidorn any comments on the code. It looks good to me.

@dbaeumer dbaeumer removed the info-needed Issue requires more information from poster label Dec 20, 2017
@dbaeumer dbaeumer added this to the December 2017/January 2018 milestone Dec 20, 2017
@dbaeumer dbaeumer added the tasks Task system issues label Dec 20, 2017
@isidorn
Copy link
Contributor

isidorn commented Dec 20, 2017

@dbaeumer I will review a bit lataer today and if it looks good I will merge it in. Thanks

@isidorn isidorn self-assigned this Dec 20, 2017
@isidorn
Copy link
Contributor

isidorn commented Dec 22, 2017

@yitongding I just reviewed the code and it looks good to me. Thanks a lot
@yitongding if you would also like to provide a pr to our vscode-docs that would also be really appreciated. If not @dbaeumer and me will cover this in our release notes and documentation in endgame week.

@yitongding
Copy link
Contributor Author

@isidorn Thanks for reviewing!
I've made a pr to microsoft/vscode-docs#1317

@yitongding yitongding deleted the addSelectedText branch December 22, 2017 17:04
@gregvanl
Copy link

gregvanl commented Dec 27, 2017

@yitongding @isidorn I'm having trouble getting this to work on 1.20 Insiders. Here's my tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "echo",
            "args": [
                "${selectedText}"
            ]
        }
    ]
}

I just see "Executing task: echo ${selectedText}". If I use "${file}" or "${lineNumber}" it works fine.

@isidorn
Copy link
Contributor

isidorn commented Dec 28, 2017

@gregvanl we have frozen insiders during the holidays - so no new updates are coming. So once we update the insiders start of january this should work just fine :)

@nileshkhaire
Copy link

It seems that ${selectedText} variable is not added yet. Anyone know in which release this will be added ? I need this for one of the task :(

@nileshkhaire
Copy link

Sorry this feature is already added in latest release but documentation is missing .

@isidorn
Copy link
Contributor

isidorn commented Apr 23, 2018

@nileshkhaire we accept PRs that fix this. Here's our repo https://github.com/microsoft/vscode-docs
fyi @gregvanl

@eightbit
Copy link

eightbit commented Nov 17, 2018

Request:
${selectedText} gets truncated to the first line, please consider including a multi-line selection when populating the variable.
Example use:

"JS Block Quote": {
	"prefix": "c2",
	"body": [
		"/* ${selectedText} */",
	],
	"description": "JS Block Quote"
}

Thanks.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tasks Task system issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants