3

I'm trying to automate some stuff for a project, for example search for dates in the files in the project directory, and then copy any found dates into a separate file.

Seems like tasks maybe could do this? But I'm having trouble, unsurprisingly.

I managed to find a way to run vscode commands from tasks.json, like this for example

"label" : "Test Command",    
"command" : "${command:editor.action.copyLinesDownAction}",

Which literally copies and pastes the line the cursor is on.

This is a good start, but I can't figure out how to pass arguments to commands like this. For example, I'd like to create a command that simply types out the current working directory, so I try

"label" : "Print CWD",
"command": "${command:type}", //Not even sure this is the right command, tbh

Which does nothing. It doesn't throw an error, either, which is nice, but it has no effect. I cannot figure out where to put the "type this string" argument, and I can't find documentation on these commands either.

Here's a Stack Exchange thread with links to all/many vscode commands, most of which I can't find documentation on.

Anyway, hope this question is relatively clear. Please let me know if I can clarify anything. Thanks.

Oh also, I'm happy to hear alternatives. Though, I'm trying to do this installing as little stuff as possible.

GeneralPancake
  • 535
  • 2
  • 6
  • 15

0 Answers0