Printing sketches

I'm using IDE 2.3.6 as well as the cloud IDE. Neither has an option to print a sketch (that I can find). Some of my sketches are hundreds of lines in length and I very much need to be able to print them out for efficient analysis and desk-checking of code. Of course I can use another editor to do it but why was the ability to print directly from the IDE removed and could it be included in later releases?

I have an extension for printing but it is not ideal either. You are better off finding a seperate editor. Why is your code so monolithic, break it up into functional modules and use the Folding option to make the code readable. As a professional many years ago I had to work with code that was thousands of lines long. It can be done.

Not an answer to your question but a thought: Printing thousands line of code is not good for the planet nor your wallet… learning to use your computer to navigate through the code is actually more effective (for most people) as you can search and use modern tools.

Hi @KQ6NO. A community member has shared instructions for adding a printing capability to Arduino IDE by installing an extension:

https://forum.arduino.cc/t/no-print-option-available/700046/18

However, I agree with @J-M-L statement that is really isn't necessary to print out your code for this purpose. Arduino IDE is based on a development editor/IDE named VS Code. The lack of a built-in printing capability in Arduino IDE is due to VS Code not having such a capability. VS Code has been, by a large margin, the most popular IDE in the world for the last 7 years. It seems that all those millions of developers who chose VS Code over other excellent alternatives don't miss a printing capability too much.

Also discussed here - Printing out hard copy of program

Are you aware of code folding? (See the screenshots below.) If you are not, it is very useful in reading/understanding long sections of code. Of course, the biggest benefit can be achieved by designing your code to use functional modularization.
#RANTING OFF
My first attempt at using modules with the IDE was to simply #include each module saved as a .h file. It works, but the preferred way is a single .h with ALL globals and forward declarations, plus one or more .cpp files of the modules.
#RANTING ON
I am including three files demonstrating the latter method, which I think is preferred. I am sure there is a tutorial on this, but my (quick) search did not turn it up.
Once your big sketches are organized in this way, you may still want a print capability. Here is what I use, but it can be improved by using an external editor. Or what about VSCODE?


HelperFuncs.cpp (711 Bytes)
HelperFuncs.h (369 Bytes)
Organization.ino (398 Bytes)

Here is the extension I use for printing.
pdconsec.vscode-print-1.4.0.vsix.zip (3.2 MB)

In KDE you got Kate (actually avail for Windows too).

Right-click the .ino file, open with Kate. Formatting like indent and colors are kept.