Visual Studio代码正在显示运行完成后在控制台线上运行的最后一个命令

发布于 2025-02-10 20:22:09 字数 801 浏览 1 评论 0原文

我正在使用Visual Studio代码版本1.68.1版本,该版本我刚刚在6/14/2022上更新。我主要将VSC用于PowerShell脚本。自从一周前的最后一个更新以来,每当我运行PS文件(F5)或运行脚本(F8)的选择时,它将显示最后一个命令运行后在控制台线上运行。因此,我重点介绍了一个选择,do f8,它在控制台线上显示了选择,显示了运行的结果,然后在结果之后显示了另一行的选择,然后我必须按ESC将其清除或backspace出来。基本上,好像我正在手动击中箭头以选择最后一个命令,只是它会自动进行。 VSC在此最新更新之前从未使用过。以前,它将完成相同的所有操作,直到最终的控制台提示线将是空的,而不会显示最后一个命令。

我尝试在线搜索是否有一个设置在最后一次更新中添加或启用,这引起了这种行为,但我找不到任何东西。我还滚动了所有终端设置,但找不到针对此行为的设置。我发现唯一相关的终端设置是终端›集成› shell Integration:历史记录控制着最近使用的命令的数量,以保留在终端命令历史记录中。设置为0至禁用终端命令历史记录。,即使将其设置为“ 0”并重新启动VSC,它仍然可以执行相同的行为,而且我仍然能够击中UP箭头以浏览浏览的历史记录我的命令。希望这里有人熟悉这一点,以及为什么VSC现在突然这样做。任何帮助将不胜感激!

这是发生了什么示例的屏幕截图:

”在此处输入图像描述”

I'm on Visual Studio Code version 1.68.1 which I just updated to on 6/14/2022. I use VSC primarily for PowerShell scripting. Ever since the last update just over a week ago, whenever I run a PS file (F5) or run a selection of a piece of a script (F8), it is showing the last command ran on the console line AFTER it has run. So I highlight a selection, do F8, it shows the selection on the console line, shows the results from the run, and then shows the selection on yet another line after the results where I then have to press ESC to clear it out or backspace it out. It's basically as if I was manually hitting the up arrow to select the last command ran, except it's doing it automatically. VSC never used to do this before this most recent update. Previously, it would do everything the same up until the final console prompt line which would be empty and not show the last command.

I've tried searching online for whether maybe there's a setting that was added or enabled on this last update that's causing this behavior, but I can't find anything. I also scrolled through all the terminal settings, and I can't find a setting specific to this behavior. The only terminal setting I could find that was kind of relevant was Terminal › Integrated › Shell Integration: History Controls the number of recently used commands to keep in the terminal command history. Set to 0 to disable terminal command history. But even after setting that to "0" and restarting VSC, it still does the same behavior and I'm still also able to hit the up arrow to scroll through the history of my commands. Hopefully someone here is familiar with this and why VSC is doing it now all of a sudden. Any help would be appreciated!

Here's a screenshot of an example of what's happening:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

荒路情人 2025-02-17 20:22:09

凯文(Kevin)

必须对此进行一些搜索。我也有同样的问题。这个问题似乎围绕着Powershell V2022.6.1扩展。大约4天前发布了一个已知的问题,并且正在积极工作。在我的PC上测试可以肯定的是,在该扩展程序的设置中,您可以在“ PowerShell> Integrated Console:使用Legacy Read line”下选中该框,并且您看到的问题已消失,但是在我的测试中,随机异常开始显示代码运行后。随机地,我会得到字母P,并决定取消选中“遗产”框。就我而言,我宁愿看到脚本始终如一地重写,而不是缺少随机的单个添加字符。

我正在阅读github中的线程以供参考。这是我开始的链接:
https://github.com/powers.com/powershell/vscode-powershell/vscode-powershell/issues/issues/4041

简短的答案是,F8等于F8,然后向上箭头,击中箭头将清除线路。目前,我们可能必须等待下一个更新。

Kevin,

Had to do a little search on this one. I have the same issue. The problem seems to revolved around the PowerShell v2022.6.1 extension. There is a known issue that was posted about 4 days ago and is / was actively being worked. In testing on my PC to be sure, in the settings for that extension you can check the box under "PowerShell>Integrated Console: Use Legacy Read Line" and the issue you are seeing goes away, however in my testing random anomalies started showing up after the code run. Randomly I would get the letter P and decided to uncheck the legacy box. In my case I'd rather see the script rewrite consistently instead of missing the random single added character.

I was reading threads in GitHub for reference. Here's the link I started with:
https://github.com/PowerShell/vscode-powershell/issues/4041

Short answer is, F8 is the equivalent of F8 then Up Arrow, hitting down arrow will clear the line. For now, we probably have to wait for the next update.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文