Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

change upload sketch #807

Open
5shekel opened this issue Apr 27, 2019 · 9 comments
Open

change upload sketch #807

5shekel opened this issue Apr 27, 2019 · 9 comments

Comments

@5shekel
Copy link

5shekel commented Apr 27, 2019

hoepfully its my lack of reading.

i am trying to change arduino.sketch to a different one in the workspace.
aside from manually changing
"sketch": "calib\\calib.ino",

i cant find a way.

@lacerto
Copy link

lacerto commented Jun 1, 2019

I also use workspaces with multiple subdirectories containing sketches and did not find a way to change the main sketch either.

If you delete "sketch" in arduino.json and try to verify or upload a sketch then the extension lets you select it from a list.
So the feature is there, it just needs to be added to the command palette, I think.

As a workaround I just wrote a task to set the value of "sketch" to the currently open file in the editor.

@ShixiangWang
Copy link

I have the same issue. I cannot change sketch when changing to another .ino file.

@Khobalt
Copy link

Khobalt commented Jul 27, 2019

Same

@danielsiwiec
Copy link

Same - this would be a nice feature to have. Perhaps an action like Upload current file

@Oskar-V
Copy link

Oskar-V commented Nov 26, 2019

+1

@MatthewSteeves
Copy link

I also use workspaces with multiple subdirectories containing sketches and did not find a way to change the main sketch either.

If you delete "sketch" in arduino.json and try to verify or upload a sketch then the extension lets you select it from a list.
So the feature is there, it just needs to be added to the command palette, I think.

As a workaround I just wrote a task to set the value of "sketch" to the currently open file in the editor.

Good idea re: workaround using task! Care to share the details?

@lacerto
Copy link

lacerto commented Jan 6, 2020

Good idea re: workaround using task! Care to share the details?

Sure. It's nothing fancy just a Python script overwriting arduino.json:
https://gist.github.com/lacerto/2a0e7f0102c02e5d01784573abc43736

The same can surely be accomplished with a couple of built-in command line utilities, maybe using jq or some other command line json processor. It was easier for me with Python.

@jgoeders
Copy link

jgoeders commented Jan 24, 2020

Sure. It's nothing fancy just a Python script overwriting arduino.json:
https://gist.github.com/lacerto/2a0e7f0102c02e5d01784573abc43736

The same can surely be accomplished with a couple of built-in command line utilities, maybe using jq or some other command line json processor. It was easier for me with Python.

Thanks, this worked well. I had to change it to:

 "command": "python",
 "args": [
       "set_main_sketch.py",
       "${workspaceRoot}",
       "${relativeFile}" // the current opened file relative to workspaceFolder
  ],

to get it to work in Windows. Also, although it changes, the status bar the bottom of VS Code doesn't reflect the change. I'm not sure how to trigger a refresh there.

@maddogjt
Copy link
Contributor

PR #1128 should cover this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests