Find yourself printing a lot to the Terminal during development and surprised to find your output missing? Read on…
Visual Studio Code’s Integrated Terminal has a default Scrollback buffer size of 1000 lines. This means that you can scroll back in the Terminal only up to 1000 lines and anything that was printed beyond this limit is lost.
For example, this Python program prints the first 5000 numbers. But if you scroll up the Terminal after the program has executed, you will find that the first 4000 odd numbers have vanished and only the last 1000 odd numbers are displayed.
To increase the buffer size of the Terminal, click File -> Preferences -> Settings and search for “Scrollback” in the search bar. You will find the following setting: Terminal -> Integrated: Scrollback, and change the number to your desired lines, for example, 10000.
Warning: If you decrease the buffer size from the previous setting, buffer will be truncated from all open Terminal windows to match the new size.
Run the code again and notice that the buffer size has increased and you’ll be able to scroll to the beginning of the session and see all content printed to the Terminal.
Note that I’m using VSCodium, a community-driven, freely-licensed binary distribution of Microsoft’s editor VS Code. To learn more about how it is different from VS Code and why we need it, check out https://vscodium.com/