VSCode setup for Development

Hi. Just some background first: I had a few ideas around printer speed profiles (similar to Bambu Labs), which I implemented as macros successfully. However, due to the code execution sequence of the macros, which limits how far I can go with my development, I decided to go for a proper extra module instead. Now, I do have some experience in VBA, Fortran and Python, but never really got into the whole Git, Github and development environments as my coding days lie back a little while already…I checked the Klipper documentation, googled for days, looked at Youtube, etc. but there just doesn’t seem to be information around regarding how to set up e.g. VSCode (or any development environment) to start developing for klipper.

Hence, to shorten the period I need to figure this out by myself, I thought, why not ask how you guys set up your development environments to debug your code, test it on your printers, keep up to date with the klipper main repo, etc. I found an article for example, which mentioned to fork the klipper main repo, then create a dev branch and clone this branch on the printer for testing. I tried this out but got a ton of warnings from mainsail update manager when I checked out the dev branch…How do you guys handle this? Is the “fork, branch and clone” the right way to go or is there a simpler way?

Any help or suggestion, which gets me up to speed faster, is very welcome. Cheers Florian

use the ssh-fs plugin in vscode to edit code directly on the printer

Interesting, is there a manual somewhere?

Kind regards, hcet14

Thanks for the replies. I did find a tutorial for ssh remote code editing:

Issue with this is, that debugging is not working. Meaning, you cant set break point, step through code, get detailed error messages, etc. I ended up editing in VSCode and then pushing the commits to the printer…Not the most elegant, but works.

if anyone has an idea how debugging can be done, that would be great. I saw the simulavr post from Kevin but haven’t gotten around to implement this yet. Does anyone have experience in getting this working on windows?

The correct thing is to fork the code on Github and then switch your git repo to this new location. You will also need to change the url for the Moonraker updates in moonraker.conf (or disable them)
As to debugging, you will not be able to use breaks points and the like because klippy is real time. Instead you will need to use the log calls to send the steps/details to the klippy log file.

Hi. Thanks for your advice. Forking and using different branches for development is what I ended up doing. I also intuitively started using logging. The only thing I couldnt figure out yet is changing the klipper repo in moonraker.conf. If you don’t mind, it would be great to see the syntax you are using =)