Comments (5)
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.
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:
- most print statements in most languages are not whitespace sensitive
- 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 wordmy_var
. You don't need need to selectmy_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.
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.
@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.
@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)
- : after text HOT 5
- Is it possible to develop support for Dart HOT 2
- new featrue want HOT 3
- command 'print-it.PrintIt' not found HOT 3
- how to escape curly braces `{` ? HOT 3
- Place PrintIt statement after multiline block not inside it. HOT 1
- [FEATURE REQUEST] use Python Icecream package instead, or optional HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-print-it.