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

Run Selection... keybinding broken after selecting Go to Code in Python Interactive #3343

Closed
willbowditch opened this issue May 29, 2019 · 8 comments
Assignees

Comments

@willbowditch
Copy link

Environment data

  • VS Code version: 1.32.1
  • Extension version (available under the Extensions sidebar): 2019.3.6558
  • OS and version: OS X 10.13.6
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv
  • Relevant/affected Python packages and their versions: Notebook==5.7.8

Expected behaviour

  1. Run selection of code (shift + enter)
  2. In Python Interactive use the "Go to code" button
  3. Run selection again (shift + enter) should rerun in Python Interactive.

Actual behaviour

On 3 shift + enter clears the selected code (as if the key binding for Python Interactive has gone).

Steps to reproduce:

As above

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Nothing reported here on error

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

Error: Illegal argument: character must be non-negative
	at Object.t.illegalArgument (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:9)
	at new f (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:315)
	at new f (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:314)
	at translate (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:316)
	at getPrecedingText (/Users/will.bowditch/.vscode/extensions/njpwerner.autodocstring-0.3.0/out/extension.js:51)
	at changeFollowsRequiredChars (/Users/will.bowditch/.vscode/extensions/njpwerner.autodocstring-0.3.0/out/extension.js:44)
	at activateFromEnter (/Users/will.bowditch/.vscode/extensions/njpwerner.autodocstring-0.3.0/out/extension.js:28)
	at context.subscriptions.push.vs.workspace.onDidChangeTextDocument (/Users/will.bowditch/.vscode/extensions/njpwerner.autodocstring-0.3.0/out/extension.js:11)
	at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:43)
	at c.$acceptModelChanged (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:496)
	at h._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:593)
	at h._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:592)
	at h._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:591)
	at h._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:590)
	at define.constructor._protocol.onMessage.e (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:588)
	at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:43)
	at e (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:39)
	at u.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:43)
	at s (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:168)
	at Socket.define.constructor._socketDataListener.e (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:168)
	at Socket.emit (events.js:182)
	at addChunk (_stream_readable.js:279)
	at readableAddChunk (_stream_readable.js:264)
	at Socket.Readable.push (_stream_readable.js:219)
	at Pipe.onread (net.js:636)
@rchiodo
Copy link
Contributor

rchiodo commented May 29, 2019

I believe this is the problem:

extensions/njpwerner.autodocstring-0.3.0

If you turn off the autodoc string extension, does the problem go away?

@willbowditch
Copy link
Author

Hi @rchiodo. Just checked, disabling autodocstring removes console error reported above (which must be unrelated), but the problem with running lines persists.

@rchiodo
Copy link
Contributor

rchiodo commented May 29, 2019

If you go to File | Preferences | Keyboard Shortcuts and type in 'Run Current' does it look like this?

image

@willbowditch
Copy link
Author

Yep, looks right.

{
  "key": "shift+enter",
  "command": "python.datascience.runcurrentcelladvance",
  "when": "editorFocus && python.datascience.featureenabled && python.datascience.hascodecells && !editorHasSelection"
}

@rchiodo
Copy link
Contributor

rchiodo commented May 29, 2019

Actually your gif shows you selecting it first. That's a different key binding:

            {
                "command": "python.datascience.execSelectionInteractive",
                "key": "shift+enter",
                "when": "editorFocus && editorLangId == python && !findInputFocussed && !replaceInputFocussed && python.datascience.ownsSelection && python.datascience.featureenabled"
            },

Do you have this setting set?

image

@willbowditch
Copy link
Author

Yep, here's mine:

{
  "key": "shift+enter",
  "command": "python.datascience.execSelectionInteractive",
  "when": "editorFocus && python.datascience.featureenabled && python.datascience.ownsSelection && !findInputFocussed && !replaceInputFocussed && editorLangId == 'python'"
}

image

@rchiodo
Copy link
Contributor

rchiodo commented May 29, 2019

Okay I got it to repro. Very weird. I have to use 'goto code' for it to repro. Just opening a file and selecting is not enough.

If I switch to a different app it stops reproing. So something with the 'when' command is messed up. I'm guessing findInputFocussed (which is a VS code selection context) is not working for some reason.

@rchiodo
Copy link
Contributor

rchiodo commented May 29, 2019

We might have to create our own findInputFocused.

@rchiodo rchiodo self-assigned this Jun 4, 2019
@rchiodo rchiodo closed this as completed Aug 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 13, 2019
@microsoft microsoft unlocked this conversation Nov 14, 2020
@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-python Nov 14, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants