nicollasricas / vscode-deck

Enables Stream Deck integration with Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=nicollasr.vscode-streamdeck
MIT License
81 stars 11 forks source link

More Documentation on how to use properly #38

Open drizztdourden08 opened 2 years ago

drizztdourden08 commented 2 years ago

Hi,

I just started to try and use this because it sounds awesome but the first thing I wanted to do, I couldn't make happen because I have no idea how we're suposed to even do it.

Which is why I'm suggesting the how to section of your readme could be updated a little.

I was mainly looking into starting specific debugging session using workbench.action.debug.selectandstart but it still ask for which I want to start. That makes it pretty useless. I get that I should probably add the json and the argument but I've tried a few things and none seems to do anything at all.

How do we find the JSON arguments for the different commands, if there is any. Is that documented somewhere?

nicollasricas commented 2 years ago

Hey,

There's no friendly documentation about those commands except for the extension API.

Here's what I do, I go to the official repository and search for the "command id", then I try to look for the arguments.

There's not much I can do here.

If you think that adding these suggestions may help, I will gladly add this to our README.

Best regards, Nicollas R.

nicollasricas commented 2 years ago

I may consider adding this as a feature in the next release.

drizztdourden08 commented 2 years ago

I have searched for it but have found nothing special. Are you searching the vscode repository or something else?

this one in particular is mentioned only in tutorial startup and stuff like that. Are these in another repository just for the extension?

Have you ever done that with your stream deck? maybe another way to do it?

nicollasricas commented 2 years ago

Hey,

I've looked in the documentation and the source code and couldn't find a way to do this. However, I could implement it through extension API.

I'm going to keep this open as a reminder.

brian-gates commented 2 years ago

I, too, am looking to send arguments to the workbench.action.debug.start command, namely nameOrConfiguration as specified here

https://github.com/microsoft/vscode/blob/0c4fa8a7b5f8ef2b59663b20d79df7776a697609/src/vs/vscode.d.ts#L8326

But I am unclear how to specify it, and would appreciate some documentation. This did not work.

{ nameOrConfiguration: 'dev' }
cording12 commented 2 years ago

Edit: This information is incorrect. Updated answer

=================================

I've worked out how to get this to run a debug config saved in your launch.json.

Here's my launch.json for a Flask app:

{
  "version": "0.2.0",
  "configurations": [

    {
      "name": "Flask - Dev",
      "type": "python",
      "request": "launch",
      "module": "flask",
      "env": {
        "FLASK_APP": "wsgi.py",
        "FLASK_ENV": "development",
        "FLASK_DEBUG": "1",
        "TEMPLATES_AUTO_RELOAD": "true",
      },
      "args": ["run"],
      "jinja": true,
      "justMyCode": true,
    }
  ]
}

In the Stream Deck software, create an Execute Command button:

Command (ID): workbench.action.debug.start Arguments (JSON): "args": {"name": "Flask - Dev"}

The name should just be equal to the name you've configured in your launch.json - in my case Flask - Dev

I've spent a long time figuring out a lot of functionality, so have some useful tips I can share - will do a pull request with @nicollasricas permission for enhanced documentation

nicollasricas commented 2 years ago

I, too, am looking to send arguments to the workbench.action.debug.start command, namely nameOrConfiguration as specified here

https://github.com/microsoft/vscode/blob/0c4fa8a7b5f8ef2b59663b20d79df7776a697609/src/vs/vscode.d.ts#L8326

But I am unclear how to specify it, and would appreciate some documentation. This did not work.

{ nameOrConfiguration: 'dev' }

Sorry that I've missed your comment notification.

The link you have sent is from the extension API, so calling as a command won't work.

It appears that @cording12 have answered already.

nicollasricas commented 2 years ago

I've worked out how to get this to run a debug config saved in your launch.json.

Here's my launch.json for a Flask app:

{
  "version": "0.2.0",
  "configurations": [

    {
      "name": "Flask - Dev",
      "type": "python",
      "request": "launch",
      "module": "flask",
      "env": {
        "FLASK_APP": "wsgi.py",
        "FLASK_ENV": "development",
        "FLASK_DEBUG": "1",
        "TEMPLATES_AUTO_RELOAD": "true",
      },
      "args": ["run"],
      "jinja": true,
      "justMyCode": true,
    }
  ]
}

In the Stream Deck software, create an Execute Command button:

Command (ID): workbench.action.debug.start Arguments (JSON): "args": {"name": "Flask - Dev"}

The name should just be equal to the name you've configured in your launch.json - in my case Flask - Dev

I've spent a long time figuring out a lot of functionality, so have some useful tips I can share - will do a pull request with @nicollasricas permission for enhanced documentation

Hey,

Thanks for figure this out.

I will gladly merge the pull request.

For those who ends up here and were wondering about the lack of documentation, I'm currently rewriting the whole project in my spare time to support multiple decks in the same codebase.

My main deck right now is Loupedeck (it was given to me by Loupedeck, thanks Emil) and since my Stream Deck broke, and I don't plan to buy a new one right now (too expensive where I live). I'm still going to support it, but the testing will be slow as I'm using a friend's spare time to test it.

There's no right way of sending the arguments for every command, it depends on how it was implemented, and it will require a bit of research.

I think we could create something like an index for these commands that are not available as an exclusive action or exposed through the API.

nicollasricas commented 2 years ago

Keeping this open for later closing in the next days when I start to push the commits from my local NAS.

SierraJC commented 2 years ago

I've worked out how to get this to run a debug config saved in your launch.json. In the Stream Deck software, create an Execute Command button:

Command (ID): workbench.action.debug.start Arguments (JSON): "args": {"name": "Flask - Dev"}

The name should just be equal to the name you've configured in your launch.json - in my case Flask - Dev

Have you tried this with multiple debug configurations? I have 4 debug configurations in my launch.json and this just launches the last configuration used, not the one specified via arguments.

cording12 commented 2 years ago

Thanks for the feedback @SierraJC - you are absolutely right, I'm seeing that behaviour too and didn't realise it due to having a single config in my launch.json.

I've done some reading and found this is a VS Code issue that would require further development of the Stream Deck VS Code extension to add such functionality to the Stream Deck buttons.

There is a workaround, albeit not ideal - you can put the entire launch config in the Stream Deck button instead. For my config above, I created an Execute Command button with the below:

Command (ID): debug.startFromConfig

Arguments(JSON):  {
      "name": "Flask - Dev",
      "type": "python",
      "request": "launch",
      "module": "flask",
      "env": {
        "FLASK_APP": "wsgi.py",
        "FLASK_ENV": "development",
        "FLASK_DEBUG": "1",
        "TEMPLATES_AUTO_RELOAD": "true"
      },
      "args": ["run"],
      "jinja": true,
      "justMyCode": true
    }

This works alongside other buttons, for example, I've made a second button for npm run dev:

Command (ID): debug.startFromConfig

Arguments(JSON): 
{
      "command": "npm run dev",
      "name": "NPM Dev",
      "request": "launch",
      "type": "node-terminal"
}
generateui commented 1 year ago

In the same vain, how to run a task? I have tried all possible combinations i.e. commanadId: workbench.action.tasks.runTask and then as Arguments:

mytask
"mytask"
{"label":"mytask"}
{"taskName":"mytask"}

I probably forgot some variations.

Oliver-Turp commented 5 months ago

I second/third/fourth this. I just got the stream deck and use VSCode semi regularly for a variety of projects. However, even the 'create terminal' event I have no idea what to put in any of the options. Some getting started docs would be very helpful :)