18

I am using console.log in my javascript program in VS code to output to the console a lot of values. When I print a few values to the console using console.log, I am able to see every value in the console window as normal. But when there are a lot of them, the values seem to get cut off. Is there some sort of option in VS code that allows me to print everything to the console without it being cut off at some limit?

Obama nation
  • 191
  • 1
  • 1
  • 6

5 Answers5

21

Go to File>Preferences>Setting and search for the Scrollback setting and increase the value to get the number of lines of output you want.

This worked for me.

Aexki
  • 211
  • 2
  • 4
3

For MAC users:

Code => Preferences => Settings => (Search for "scrollback") => Write higher number for "Terminal › Integrated: Scrollback".

Arin Yazilim
  • 939
  • 8
  • 6
0

In order to achieve that you need to make a change in your launch.json configuration of xdebug in VS Code.

The piece of configuration you will need to add to your configuration of launch.json is "xdebugSettings": { "max_data": -1 }

A simple configuration should look like that

{ "version": "0.2.0", "configurations": [ { "name": "Listen for XDebug", "type": "php", "request": "launch", "port": 9000, "serverSourceRoot": "/var/www/myapp/", "localSourceRoot": "${workspaceRoot}/", "xdebugSettings": { "max_data": -1 } }] }

xdebugSettings.max_data Controls the maximum string length that is shown when variables are displayed. To disable any limitation, use -1 as value.

Good luck.

Govi-Boy
  • 89
  • 10
  • This was exactly what I was looking for, PHP XDebug max buffer limit just didn't think I would find it in a JS debug question, haha, thanks. – Machado Jan 14 '22 at 00:02
0

if the string is large then use log("value".tosting()). to check the answer

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 01 '22 at 08:58
0

inside vs code settings search for scrollback option and change the second option to number of lines you want vscode screenshot

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 27 '23 at 15:00