Comments (11)
That bit of strangeness comes from using python -e
.
If we wanted to get around that, we'd have to make a tempfile.
from atom-script.
Ach, weird new lines aren't interpreter as such:
$ python -c "\n\nfoo"
File "<string>", line 1
\n\nfoo
^
SyntaxError: unexpected character after line continuation character
from atom-script.
Color me corrected, I understand now.
from atom-script.
Looking back at the gif, it's because I selected the line above it. Check this out:
I think the demo gif is just a bit haphazard for when I'm selecting (I get nervous recording for the world I think).
from atom-script.
Yeah, line 2 makes sense, I was suggesting it could show line 22.
from atom-script.
ohhh, so sorry. Yeah, we should prepend newlines. Kind of hacky but it would be nice.
I think the reason python -c "\n\nfoo"
didn't handle well is that it interpreted as a literal backslash n.
from atom-script.
@rgbkrk @hayd My changes from #107/#108/#109 should help:
"Selection Based":
command: "python"
args: (filename, selection) ->
buffer_row_range = selection.getBufferRowRange()
line_number = buffer_row_range.reduce (a, b) -> Math.min(a, b)
line_number += 1
n = 1
# ... calculate the number of newlines to add ...
[Array(n).join("\n"), filename]
from atom-script.
Just realized this happens for at least Ruby, Coffeescript, and Perl too... 😆 I guess the solution is to prepend the whitespace "\n"
to all grammars? @rgbkrk What's your opinion?
from atom-script.
As long as the whitespace doesn't affect the interpretation of the code.
from atom-script.
Also, yuck. The only other solution would be if you could specify to an interpreter what line number to treat it as coming from. AFAIK, that's not a feature anywhere. Sadly, I think prepending newlines is what we need to do.
from atom-script.
Yeah. Should we make it an optional/boolean param on the getCode method (prepend set to true/false) and manually enable it per languages vs. polluting all of them with whitespace (some interpreters could be picky about it)?
from atom-script.
Related Issues (20)
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated.
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- Runtime Input
- HTMLDocument.registerElement is deprecated. HOT 1
- TypeError HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- certificate has expired HOT 1
- Port this to Pulsar
- HTMLDocument.registerElement is deprecated.
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated.
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated. HOT 1
- HTMLDocument.registerElement is deprecated.
- HTMLDocument.registerElement is deprecated.
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 atom-script.