bmalehorn / vscode-print-it

Wrap a print statment around current word or selection
4 stars 3 forks source link

Add semicolon postfix option #10

Closed phoihos closed 3 years ago

phoihos commented 3 years ago

This PR adds an option Whether to add or not a semicolon in the end of the log message.

bmalehorn commented 3 years ago

Hi @phoihos, thanks for the suggestion.

When I was writing this extension, I wasn't sure if which of these forms people would prefer:

x = 5 <- what I used at the time
x: 5
x 5
@@@ x = 5 <- also a form I used, easy to search

I decided the default formatting should be the simplest one possible that doesn't commit to any particular symbol. But I left the option open to configure it to anything you wanted by changing the print-it.<language>.template.

Couldn't you achieve the same thing by changing these settings?

  "print-it.javascript.template": "console.log(\"{{escaped}}:\", {{raw}});",
  "print-it.typescript.template": "console.log(\"{{escaped}}:\", {{raw}});",
  "print-it.typescriptreact.template": "console.log(\"{{escaped}}:\", {{raw}});",
  "print-it.javascriptreact.template": "console.log(\"{{escaped}}:\", {{raw}});",

If I did change this, I'd prefer to just make it the default rather than have a bunch of flags to configure how the output should look.

phoihos commented 3 years ago

Ok. I see. Thank you for your replying.