atom-community / atom-community/atom-script
`Script: Run` doesn't behave as expected after you highlight and comment-out lines of code
- Dominant language
- JavaScript
- Stars
- 730
- Forks
- 264
- PR merge metrics
- No merged PRs in 30d
Description
OS: Ubuntu 16.04 LTS
Atom version: 1.23.1 x 64
Python version: Python 3.6.3, Python 2.7.12, and Python 3.5.2 (tested on all three)
I am experiencing an issue with the `Script: Run` command. It must be sending the wrong text to Python. Here are the steps to reproduce the problem:
**Step 1.** input the following text into a `.py` file:
```
x = 'hello'
print(x)
```
**Step 2.** Hit Ctrl+Shift+B to run `Script: Run` and the correct output is displayed:
```
hello
[Finished in 0.046s]
```
**Step 3.** Using your cursor, highlight the first line of the code, namely `x = 'hello'`.
**Step 4** Hit Ctrl+/ to comment it out. Remember: you must highlight the line using your cursor first. If you simply hit Ctrl+/ on th
**Step 5.** Hit Ctrl+Shift+B to run `Script: Run` and the following **incorrect** output is displayed:
```
[Finished in 0.065s]
```
Since we have removed the x's definition, python should display a `NameError`, but it does not.
**Step 6.** Now try adding a few newlines to the bottom of the file and hit Ctrl+Shift+B to run `Script: Run` and now the correct output is displayed:
```
Traceback (most recent call last):
File "/home/test/test.py", line 2, in
print(x)
NameError: name 'x' is not defined
[Finished in 0.078s]
```
If Step 3 is skipped, and you simply hit Ctrl+/ while on the first line of code, the issue does not occur.
Contributor guide
Assessment
This issue has not been assessed yet.