创建新的无标题文件并设置语言模式 [英] Create new untitled file and set language mode

查看:18
本文介绍了创建新的无标题文件并设置语言模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个宏

"macros": {
    "newScratchFile": [
        "workbench.action.files.newUntitledFile",
        "workbench.action.editor.changeLanguageMode"
    ]
},

过去与这个扩展配合使用效果很好,但似乎微软坏了它作为某个时间点.

Which used to work great with this extension but it appears Microsoft broke it as some point in time.

现在,当我激活它时,我确实得到了一个新的无标题文件,语言模式弹出窗口会打开一瞬间,但在我有机会输入任何内容之前就消失了.

Now when I activate it, I do get a new untitled file, and the language mode popup opens for a split second but then disappears before I get a chance to type anything.

有没有办法修复我的宏以便语言选择器保持打开状态?

Is there a way to fix my macro so the language picker remains open?

推荐答案

很抱歉,这可能是宏扩展.该扩展已经安静"了一段时间,并且两个 PR 非常重要(请参阅问题)并且尚未合并.所以扩展已经分叉了.我是原始宏扩展的忠实粉丝,但现在我使用 multi-command 哪个效果更好.

I'm sorry to say it is probably the macro extension. That extension has been "quiet" for awhile and the two PR's are pretty important (see the issues) and haven't been incorporated. So the extension has been forked. I was a big fan of the original macros extension but now I use multi-command which works better.

我在多命令中尝试了你的命令,它完美无缺.

I tried your commands in multi-command and it works flawlessly.

{
    "command": "multiCommand.newFileAndMode",
    // "interval": 250,
    "sequence": [

      "workbench.action.files.newUntitledFile",
      "workbench.action.editor.changeLanguageMode"
    ]
}

它还支持执行命令之间的间隔时间,这有时会派上用场.参见,例如,vscode 终端:无提示终止进程我的在那里回答终止进程并回答 Y 并从文本编辑器或终端输入一个键和键,如果没有延迟就无法工作 - 进程终止.

It also has support for an interval time between execution of the commands which occasionally comes in handy. See, e.g., vscode terminal: terminate process without prompt my answer there to terminating a process and answering Y and enter in one keychord from a texteditor or terminal which wouldn't work without the delay - for the process to terminate.

这篇关于创建新的无标题文件并设置语言模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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