Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workbench.action.terminal.runSelectedText issue with IPython #61892

Closed
louisabraham opened this issue Oct 26, 2018 · 8 comments
Closed

workbench.action.terminal.runSelectedText issue with IPython #61892

louisabraham opened this issue Oct 26, 2018 · 8 comments
Assignees
Labels
help wanted Issues identified as good community contribution opportunities *out-of-scope Posted issue is not in scope of VS Code terminal Integrated terminal issues
Milestone

Comments

@louisabraham
Copy link

  • VSCode Version: 1.28.2
  • OS Version: macOS 10.12.6

Steps to Reproduce:

  1. Open an ipython console
  2. Select some code block with multiple indented lines
  3. Use workbench.action.terminal.runSelectedText

Example:

def f(x):
    x *= 2
    return x

Result:

In [4]: def f(x):
   ...:         x *= 2
   ...:             return x
  File "<ipython-input-4-110910b1aeaa>", line 3
    return x
    ^
IndentationError: unexpected indent

Explanation:

IPython automatically indents when you type return. However, when pasting the whole code block or each line it doesn't. The problem probably comes from the fact than vscode simulates a return key instead of a simple newline when sending the line.

@vscodebot vscodebot bot added the editor-autoindent Editor auto indentation issues label Oct 26, 2018
@louisabraham
Copy link
Author

Another issue arises when trying to execute multiple lines with the same indentation

import math
import os

Only the first line is sent.

@weinand weinand added *caused-by-extension Issue identified to be caused by an extension and removed editor-autoindent Editor auto indentation issues labels Oct 27, 2018
@vscodebot
Copy link

vscodebot bot commented Oct 27, 2018

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Oct 27, 2018
@louisabraham
Copy link
Author

@weinand This issue is NOT caused by an extension. I could reproduce with code --disable-extensions.

@weinand weinand reopened this Oct 27, 2018
@weinand weinand removed the *caused-by-extension Issue identified to be caused by an extension label Oct 27, 2018
@lj-mu
Copy link

lj-mu commented Nov 1, 2018

Same problem with me, I have to copy and paste manually.

@Tyriar
Copy link
Member

Tyriar commented Dec 3, 2018

I believe this is an issue with ipython as it only affects it.

@louisabraham
Copy link
Author

I would like to reopen this issue.

In vim, the slime plugin has a variable slime_python_ipython. If it is set and the current language is python, then it wraps the text with %cpaste.
This should be implemented in vscode as well.

@Tyriar Tyriar reopened this Dec 17, 2018
@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities terminal Integrated terminal issues labels Dec 17, 2018
@Tyriar Tyriar added this to the Backlog milestone Dec 17, 2018
@cbrnr
Copy link

cbrnr commented Apr 29, 2019

Although this is not caused by the Python extension, maybe the suggested change (using %cpaste) should be implemented in the extension - someone already created an issue: microsoft/vscode-python#2837

@Tyriar Tyriar added *out-of-scope Posted issue is not in scope of VS Code and removed bug Issue identified by VS Code Team member as probable bug labels Oct 8, 2019
@vscodebot
Copy link

vscodebot bot commented Oct 8, 2019

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@vscodebot vscodebot bot closed this as completed Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues identified as good community contribution opportunities *out-of-scope Posted issue is not in scope of VS Code terminal Integrated terminal issues
Projects
None yet
Development

No branches or pull requests

5 participants