VS Code 在集成控制台中执行当前行或选择 [英] VS Code execute current line or selection to in the integrated console

查看:46
本文介绍了VS Code 在集成控制台中执行当前行或选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个习惯使用 elpy 的 Emacs 老用户,正试图用 Scala 和 VSCode 迁移到 VSCode更具体地说是菊石复制品.

This old Emacs user, who is used to elpy, is attempting to move onto VSCode with Scala & more specifically Ammonite repl.

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

I used Ctrl+' to open the integrated terminal & all I have to do is type amm on the bash shell (ubuntu) to open the repl; however, I still miss being able to send the either the line or selection from the editor to integrated shell with Ctrl+Enter.

我想这意味着一些编码.我可以从哪里开始?有没有人完成过类似的工作?

I guess this means a bit of coding. Where can I start? Has anyone accomplished similar?

非常感谢,

推荐答案

其实我发现加入 VSCode 扩展完成了这项工作:

Actually, I found that adding VSCode Macros extension does the job:

我刚刚更改了 settings.json:

I just changed settings.json:

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

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

and added (1st part is pure @kwood & thank u again) to 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"}

这篇关于VS Code 在集成控制台中执行当前行或选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆