Comments (1)
Hey @xxxxxxbox, I'm definitely aware of this problem and run into it all the time. I do what you describe - I use the Move Line Downward
keyboard shortcut (⌥ ↓
on Mac) to move it to the appropriate place after it's created.
print-it is a basic tool that just operates on text strings. It does not parse Python / JavaScript / Java / Ruby source code and does not understand a concept like "find the end of this statement". There are extensions, like the Python extension, that do parse Python code and tell VSCode how to syntax highlight each part, where function definitions are, etc.
However I'm not sure if there's any way in the VSCode extension API for print-it to get that language information from the Python extension. Correct me if I'm wrong, but I don't think there are any VSCode extensions that understand the Python language other than the Python extension itself.
So I probably will not implement this until VSCode extension API gives me a function like findStatementEnd({ line: 100, column: 5 })
. If you find an API endpoint that does that sort of thing (or an extension that seems to understand Python code), feel free to let me know!
Also I could do some heuristic like trying to find a closing )
for the current line. I did that in another extension a while ago (https://github.com/bmalehorn/click-mode/blob/b94ea8cce89cf0e753b2ab915202d49ffc470fb6/click-mode.el#L66-L223), but most of that extension became parsing code which was always imperfect and could be tuned & special-cased forever. I'd rather insert the print statement in an obviously-wrong place rather than invite endless tweaks to the statement-finder code.
Does that all make sense?
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
- It's not possible to set template for python with usuing f-string HOT 5
- [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.