交互式窗口中的Visual Studio代码Python运行部分不工作

2024-10-01 00:23:43 发布

您现在位置:Python中文网/ 问答频道 /正文

当我在Visual Studio代码中使用python扩展名处理.py文件时,我曾经能够在交互式窗口中使用Alt+Enter或单击上下文菜单(在所附屏幕截图中高亮显示)运行选定的行。最近,它不再工作了。据我所知,自从上次跑步以来,我没有做任何改变。附加了.json文件中的自定义项

此外,在实验室pc中,我无法在上下文菜单中找到操作。当我在编辑器中选择行并右键单击时,我想知道在何处将其添加到上下文菜单中

电脑设置:

  • Python扩展:2020.1.57204

  • 版本:1.41.1(系统设置)

  • 提交:26076a4de974ead31f97692a0d32f90d735645c0

  • 日期:2019-12-18T14:58:56.166Z

  • 电子:6.1.5

  • 铬:76.0.3809.146

  • Node.js:12.4.0

  • V8:7.6.303.31-electron.0

  • 操作系统:Windows\u NT x64 10.0.18363

“Settings.json”中的设置

{
"files.autoSave": "afterDelay",
"editor.formatOnType": true,
"editor.formatOnSave": true,
"python.linting.flake8Enabled": true,
"python.dataScience.askForKernelRestart": false,
"python.globalModuleInstallation": true,
"python.dataScience.sendSelectionToInteractiveWindow": true
}

keybinds.json中的所有键绑定:

// Place your key bindings in this file to override the defaultsauto[]
[
    {
        "key": "shift+enter",
        "command": "python.datascience.runFileInteractive"
    },
    {
        "key": "shift+enter",
        "command": "-python.datascience.runcurrentcelladvance",
        "when": "editorTextFocus && python.datascience.featureenabled && python.datascience.hascodecells && !editorHasSelection"
    },
    {
        "key": "alt+enter",
        "command": "python.datascience.execSelectionInteractive",
        "when": "editorTextFocus && python.datascience.featureenabled && python.datascience.ownsSelection && !findInputFocussed && !replaceInputFocussed && editorLangId == 'python'"
    },
    {
        "key": "shift+enter",
        "command": "-python.datascience.execSelectionInteractive",
        "when": "editorTextFocus && python.datascience.featureenabled && python.datascience.ownsSelection && !findInputFocussed && !replaceInputFocussed && editorLangId == 'python'"
    },
    {
        "key": "shift+enter",
        "command": "-python.execSelectionInTerminal",
        "when": "editorTextFocus && !findInputFocussed && !python.datascience.ownsSelection && !replaceInputFocussed && editorLangId == 'python'"
    }
]

How do I add this option manually?


Tags: keyjsontrueshift菜单commandwhenenter