bmalehorn / vscode-print-it

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

: after text #1

Closed yalin closed 4 years ago

yalin commented 4 years ago

It's not an issue, a request. Is it possible to add a colon ":" after text? So, it will seem like this; console.log('x :', x)

And for the people who used to without colon, it can be an option or a parameter got from the user because some people would want; console.log('x =, x)

bmalehorn commented 4 years ago

I think this is a reasonable idea - I figure people will want to customize the function.

I want to make it general enough that people could put :, =, or whatever they want after the variable. And they should be able to change the logging function. What would you think of templating settings like this?

"print-it.javascriptreact.template": "console.log('{{escaped}} :', {{raw}});"

The templating language would probably use micromustache: https://github.com/userpixel/micromustache

Would you like a setting like that?

yalin commented 4 years ago

Sounds like a great way of doing it. It will also allow people not to strained with : or =. Moreover, it can be added to other languages on request too. Thanks for the modification though.

bmalehorn commented 4 years ago

Alright, it's now live! The above config should work, and see https://github.com/bmalehorn/vscode-print-it#templating for more documentation.

Does it work as expected?

yalin commented 4 years ago

image

Javascript works perfectly, thank you! But there is a problem with Python (I tested, brackets are forgotten by default. I put the brackets and it worked) and Ruby I guess (I don't know Ruby) FYI

bmalehorn commented 4 years ago

Ah yep, good catch. I've now updated it to fix Python, Ruby, and Erb files.

Closing out this issue since the feature is now available.