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/line in python terminal keyboard shortcut not working #12057

Closed
DTKx opened this issue May 29, 2020 · 3 comments
Closed

Run selection/line in python terminal keyboard shortcut not working #12057

DTKx opened this issue May 29, 2020 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@DTKx
Copy link

DTKx commented May 29, 2020

#1349

Environment data

  • VS Code version: 1.45.1 (user setup)
  • Extension version (available under the Extensions sidebar): Version: 1.45.1 (user setup)
  • OS and version: Windows_NT x64 10.0.18363
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.3 32 2020.5.80290
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: NA
  • Relevant/affected Python-related VS Code extensions and their versions: ms-python.python
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): false
  • Value of the python.languageServer setting: 0.5.45.0

Expected behaviour

When selecting some lines codes and pressing the keyboard F9 (as default) for running selection line in the python terminal it was expected to run the selected lines in the python terminal.

Actual behaviour

Hey! I would like to please ask for some help. Thanks!
When selecting some lines codes and pressing the F9 as default for running selection line in the python terminal no actions happened, however pressing the same command manually yes.
Therefore i have tried to change the shortcut to ctrl + enter (accodring to #1349)
also eliminating any duplicate shortcut,however still no action was performed.

Steps to reproduce:

select code
press keyboard shortcut recognized as running selection/lines in python terminal (tried using the f9 and also changing the keyboard to ctrl+enter.

Logs

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

settings.json file as below
``

`{
    "workbench.colorTheme": "Visual Studio Dark",
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "gitlens.currentLine.enabled": false,
    "gitlens.hovers.currentLine.over": "line",
    "gitlens.codeLens.enabled": false,
    "python.jediEnabled": false,
    "files.autoSave": "afterDelay",
    "python.dataScience.sendSelectionToInteractiveWindow": true,
    "window.zoomLevel": 0,
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    "editor.minimap.enabled": false,
    // DK modification
    "code-runner.executorMap": {
        “python”: “C:\Users\debor\AppData\Local\Programs\Python\Python38\python.exe”
}``

</p>
</details>

<br />

<details>

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

<p>

XXXX


</p>
</details>
@DTKx DTKx added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels May 29, 2020
@luabud
Copy link
Member

luabud commented Jun 1, 2020

Hey @DTKx! The default shortcut for running selections/lines is Shift + Enter, not Ctrl + Enter.

You may be able to to configure it to F9 by adding the following content to your keybindings.json file (View > Command Palette... and run "Preferences: Open Keyboard Shortcuts (JSON)"

[
    {
        "key": "f9",
        "command": "python.execSelectionInTerminal",
        "when": "editorTextFocus && !findInputFocussed && !python.datascience.ownsSelection && !replaceInputFocussed && editorLangId == 'python'"
    },
]

You'll know if it was successfully updated if you open a Python file and right click on the editor, then look for the "Run Selection/Line in Python Terminal" command. The new shortcut will appear right next to it:
image
image

Would you mind pasting here a screenshot of what it shows next to this command for you?

@luabud luabud added the triage label Jun 1, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jun 1, 2020
@luabud luabud self-assigned this Jun 1, 2020
@luabud luabud added the info-needed Issue requires more information from poster label Jun 1, 2020
@DTKx
Copy link
Author

DTKx commented Jun 2, 2020

Hello @luabud !
Thanks you for the detailed answer.
Sorry i guess I did not explain well, here is a print:
image

Therefore, I knew i the modification was acknowledged, however when I hit the keyboard shortcut mentioned in the options the command run selection is not performed.
In order to perform the run selection all the time i need to open up the options scrolll down to run selection in the menu and press enter (manually).

I have checked the json file and I found two duplicates for the execSelection

image

So I commented one to test and still the keyboard shortcut did not work.

To try again, I modified the shortcut to f9 and tested, but still no answer.

Moreover, I am not sure if this would help, but i have tried to reinstall visual studio, however it did not uninstalled completellly, I wonder if a complete uninstall could fix this issue for the moment, i also checked and I did not found a documentation on how to completelly uninstall VS.

Any potential clue is welcomed :)

Thanks

@luabud
Copy link
Member

luabud commented Jun 9, 2020

Thanks for the info, @DTKx! Since the shortcuts aren't triggering anything, I believe the issue would be in VS Code and not the Python extension. A reinstall might help indeed.

You raised a good point, it isn't documented how to completely uninstall VS Code. I'll open an issue on our docs repo, but in the mean time this could help: https://superuser.com/questions/1380208/how-to-completely-uninstall-visual-studio-code-from-windows-10.

I'm closing the issue since there's no action item on the Python extension. Let me know how the reinstall goes, I hope it works!

@luabud luabud closed this as completed Jun 9, 2020
@ghost ghost removed the triage label Jun 9, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants