Giter VIP home page Giter VIP logo

Comments (5)

bmalehorn avatar bmalehorn commented on August 22, 2024 1

Hey @xxxxxxbox , thanks for the feedback. I decided to bite the bullet and just fix this bug by fixing the formatter. If you try out the latest version of print it, this configuration:

"print-it.python.template": "print(f'{{{raw}}=}')",

On this string:

var + "foo"

produces this print statement:

print(f'{var + "foo"=}')

Does that work for you?

from vscode-print-it.

bmalehorn avatar bmalehorn commented on August 22, 2024 1

Hi @bmalehorn. Now it works like a charm. Thanx a lot!

Glad it's working well!

One more suggestion. While testing once I selected my_var with nearest spaces and PrintIt produced the following result: print(f'{ my_var =}')

Due to spaces this statement doesn't work in python.

Not shure if it is a common problem. But adding to PrintIt simple trim / strip spaces next to "raw" could fix it.

This probably doesn't happen too often, because:

  1. most print statements in most languages are not whitespace sensitive
  2. If you put the cursor like this: my_v|ar where | is the cursor then run print-it, it will add a print statement for the current word my_var. You don't need need to select my_var yourself.

But I can't think of a reason why anyone would want leading / trailing whitespace, so I implemented your suggestion in bd07e7f. Whitespace is now trimmed from your selection before printing.

from vscode-print-it.

xxxxxxbox avatar xxxxxxbox commented on August 22, 2024

Hi @bmalehorn.
Now it works like a charm. Thanx a lot!

One more suggestion.
While testing once I selected my_var with nearest spaces and PrintIt produced the following result:
print(f'{ my_var =}')

Due to spaces this statement doesn't work in python.

Not shure if it is a common problem. But adding to PrintIt simple trim / strip spaces next to "raw" could fix it.

from vscode-print-it.

xxxxxxbox avatar xxxxxxbox commented on August 22, 2024

@bmalehorn, Thanks a lot!

P.S. Auto selection of word works great, but sometimes users need to manualy select part of statement for "printing"

For example:
var = car.sensors.speed

Auto selection would select only one of three words - car / sensors / speed
But a user sometimes would like to print:

car
car.sensors
car.sensors.speed

from vscode-print-it.

bmalehorn avatar bmalehorn commented on August 22, 2024

@xxxxxxbox Ah yep that makes sense. I also have to select to print expressions like that.

Closing this ticket as the underlying issue is resolved.

from vscode-print-it.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.