0

这位用于elpy的旧Emacs用户正尝试使用Scala &转移到VSCode上,更具体地说是Ammonite repl。VS代码在集成控制台中执行当前行或选择

我用Ctrl +'打开集成终端&我所要做的就是在bash shell(ubuntu)上键入amm来打开repl;然而,我仍然错过能够通过Ctrl + Enter将编辑器中的行或选择发送到集成shell。

我想这意味着一点编码。我可以从哪里开始?有没有人完成类似?

谢谢了,

+0

看看https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner –

+0

Aluan:至少需要调整一下,但看起来很有希望。至少我应该能够把它作为一个样本。非常感谢, – user6273920

回答

3

如果你已经有终端和REPL开放,有一个内置的名为“在运行活动的终端所选文本”/workbench.action.terminal.runSelectedText命令。

它没有默认的键绑定,所以你需要自己设置它。像这样的东西会工作:

{ 
    "key": "ctrl+enter", 
    "command": "workbench.action.terminal.runSelectedText", 
    "when": "editorTextFocus && editorHasSelection" 
} 
+0

是的,这个工程!我想真正的工作就是饶恕。我想我需要使用任务添加多个命令。 “when”:“editorTextFocus &&!editorHasSelection” “commands”:“expandLineSelection”&“workbench.action.terminal.runSelectedText”&“cancelSection” 但这确实不错。谢谢 – user6273920

+0

我刚刚发布了回答我上面添加的评论Q扩展。 – user6273920

3

事实上,我发现,添加VSCode Macos扩展这项工作:

我只是改变settings.json:

{ 
    "window.zoomLevel": 1, 
    "editor.fontSize": 11, 
    "terminal.integrated.fontSize": 11, 
    "macros": { 
     "execCurLn": [ 
      "expandLineSelection", 
      "workbench.action.terminal.runSelectedText", 
      "cancelSelection" 
     ] 
    } 
} 

,并添加(第一部分纯@kwood &再次感谢你)keybindings.json

{ 
     "key": "ctrl+enter", 
      "command": "workbench.action.terminal.runSelectedText", 
      "when": "editorTextFocus && editorHasSelection" 
    } 
    { 
     "key": "ctrl+enter", 
      "command": "macros.execCurLn", 
      "when": "editorTextFocus && !editorHasSelection" 
    }, 
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus"}, 
{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"} 
相关问题