Visual Studio Code 集成终端中的 SIGINT [英] SIGINT in Visual Studio Code Integrated Terminal

查看:26
本文介绍了Visual Studio Code 集成终端中的 SIGINT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在常规的 Windows 终端中,Control+C 键绑定到 SIGINT,允许您中断正在运行的进程.Visual Studio Code 的集成终端使您可以通过 terminal.integrated.commandsToSkipShell 来传递关键命令,这非常有用.尽管默认情况下 Control+C 键绑定到复制,但 SIGINT 在设置键绑定的设置中并不明显.您如何将 SIGINT 发送到 Visual Studio Code 集成控制台,最好对其进行键绑定,以便您可以向进程发出停止或中断信号?

In the regular windows terminal Control+C is keybound to SIGINT allowing you to break a running process. Visual Studio Code's Integrated Terminal enables you to have passthrough key commands through terminal.integrated.commandsToSkipShell, which is quite useful. Although Control+C is keybound to copy by default, SIGINT isn't readily apparent in the settings to set up a keybind for. How can you send SIGINT to the Visual Studio Code Integrated console, and preferably keybind it, so that you can signal processes to stop or interrupt?

这是我能够找到的文档,不幸的是,它没有提到 SIGINT 或使用 Control+C 进行中断,我认为这是一个常见的需求:https://code.visualstudio.com/docs/editor/integrated-terminal

Here is the documentation I was able to find, which unfortunately has no references to SIGINT or using Control+C for interrupts which I imagine is a common need: https://code.visualstudio.com/docs/editor/integrated-terminal

推荐答案

原来在 Visual Studio Code for Windows 上,ctrl-cctrl-v 之间其他命令设置为绕过终端并由 VSCode 本身处理.

It turns out that on Visual Studio Code for Windows, ctrl-c and ctrl-v among other commands are set to bypass the terminal and be handled by VSCode itself.

要修复,只需打开您的首选项 File>Preferences>Settings (ctrl-,) 并添加您自己的 terminal.integrated.commandsToSkipShell 设置价值.最好让 VSCode 使用它的智能感知功能为您完成工作,以便您获得所有默认值,这样您就不会意外更改您希望工作的其他行为.

To fix simply open your preferences File>Preferences>Settings (ctrl-,) and add your own terminal.integrated.commandsToSkipShell settings value. It's best to let VSCode do the work for you by using it's intellisense feature so that you get all the defaults included so that you don't accidentally change other behaviour you expected to work.

然后继续删除 workbench.action.terminal.copySelection 以让 ctrl-c 工作和 workbench.action.terminal.paste> 使 ctrl-v 工作.

Then go ahead and remove the workbench.action.terminal.copySelection to let ctrl-c work and workbench.action.terminal.paste to get ctrl-v to work.

粘贴到终端对 ctrl-shift-v 仍然有效,但我还没有弄清楚如何进行复制.如果我这样做,我会更新这个答案.

Pasting into the terminal will still work for ctrl-shift-v but I haven't yet figured out how to make copying work. I'll update this answer if I do.

这篇关于Visual Studio Code 集成终端中的 SIGINT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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