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

More Documentation on how to use properly #38

Open
drizztdourden08 opened this issue Mar 21, 2022 · 13 comments
Open

More Documentation on how to use properly #38

drizztdourden08 opened this issue Mar 21, 2022 · 13 comments
Labels
enhancement New feature or request

Comments

@drizztdourden08
Copy link

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
Copy link
Owner

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
Copy link
Owner

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

@drizztdourden08
Copy link
Author

drizztdourden08 commented Mar 23, 2022

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 nicollasricas added the enhancement New feature or request label Mar 29, 2022
@nicollasricas
Copy link
Owner

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
Copy link

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
Copy link

cording12 commented Aug 4, 2022

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
Copy link
Owner

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
Copy link
Owner

nicollasricas commented Aug 4, 2022

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
Copy link
Owner

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

@SierraJC
Copy link

SierraJC commented Aug 4, 2022

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
Copy link

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
Copy link

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
Copy link

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 :)

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

No branches or pull requests

7 participants