andrewferrier / debugprint.nvim

Debugging in NeoVim the print() way!
MIT License
298 stars 18 forks source link

Consider changing console.debug to console.log #72

Closed andrewferrier closed 4 months ago

andrewferrier commented 7 months ago

https://www.reddit.com/r/neovim/comments/1848aoc/comment/kaw948m/?utm_source=share&utm_medium=web2x&context=3

andrewferrier commented 7 months ago

This has been done: https://github.com/andrewferrier/debugprint.nvim/commit/c8341fddca633ffe8b50474601c3651f260dbeed.

CarlosMed commented 5 months ago

I know you had set this to console.warn but this sometimes muddies the console as seen In the pic. If you default to console.log, it should suffice for everything under the JS umbrella.

image

vs

image
andrewferrier commented 5 months ago

@CarlosMed hmm, this is a tricky one. JavaScript is not just used in browsers, but in NodeJS and other runtimes too, so I'm cautious about optimising for the browser use case by creating an exception from the usual principle of making DEBUGPRINT stand out, common though it might be. Is that the default behaviour of your browser?

CarlosMed commented 5 months ago

As far as I know, NodeJS also has a console.log as well as DenoJS and BunJS. On the above with console.warn it throws in way too much info that's unnecessary. The only way I guess to appease people would be to make the console more agnostic where It can be changed in the config from log or warn.

andrewferrier commented 5 months ago

@CarlosMed so I've done some testing of console.log(), console.warn(), console.debug() and console.error():

I can't recreate what you are showing in your screenshots. My guess would be (I don't do much browser JavaScript) that you are logging an variable/object with a stacktrace called 'error', in which case it makes sense (I think) that it's expanded.

So I'm unclear what issue you're referring to when you say 'way too much info' - from my testing it seems like it's the same level of info whichever console method you use. Can you provide some more specific recreation instructions?

Of course, remember you can always override the behaviour in any event in your own config as described here. If you specify an existing filetype, it will override the behaviour for that filetype.

CarlosMed commented 5 months ago

The above solved my issue. Since it makes it flexible. Thank you!

andrewferrier commented 4 months ago

OK, thanks. I'm closing this issue since I can't recreate the specific problem you described and it sounds like you've fixed with changes to your own config. Thanks for your contribution!