VSCODE:防止文件在新标签中打开

发布于 2025-01-28 20:43:52 字数 482 浏览 0 评论 0原文

我有两个文件并排打开,如图中所示:

“

如果我 ctrl +单击函数名称左窗格中的两个,我希望VSCODE将vScode切换为已打开的文件第二。 py在右窗格中。相反,VSCODE在当前左窗格的新选项卡中打开文件second.py(在红色矩形指示的位置)。现在,您有三个选项卡,而不是两个选项卡,first.py从视图中遮盖了。

如何更改此行为,以使VSCODE焦点已经打开了选项卡,而不是打开一个新的冗余选项卡?

I have two files open side by side like shown in the picture:

Split panes.

If I Ctrl+Click the function name two in the left pane, I want VSCode to switch focus to already opened file second.py in the right pane. Instead, VSCode opens file second.py in a new tab in the current left pane (in a place indicated by red rectangle). Now you have three tabs instead of two, and first.py is obscured from view.

How can I change this behavior so that VSCode focuses already opened tab, instead of opening a new, redundant tab?

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

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

发布评论

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

评论(2

爱情眠于流年 2025-02-04 20:43:52

当问题发布在这里时,也许这是不可用的,但是现在有专门的设置要这样做:

"workbench.editor.revealIfOpen": true

Perhaps this wasn't available when the question was posted here but there's dedicated setting to do this now:

"workbench.editor.revealIfOpen": true
潦草背影 2025-02-04 20:43:52

我通过以下操作在Windows上的VS代码中解决了此问题:

  • ctrl+p
  • type设置。JSON
  • 打开用户文件夹中的一个
  • 在JSON添加的根级别上
"window.openFilesInNewWindow": "off",
"workbench.editor.enablePreview": false

“ workbench.editor.editor.enable.enablepreview”:false“:false” << 是此解决方案的可选部分

/代码>当您单击文件时,这 打开一个文件,如果该文件已经打开,它将聚焦该文件的选项卡。

I solved this in VS Code on windows by doing the following:

  • ctrl+p
  • type settings.json
  • open the one in your user folder
  • At the root level of the JSON add:
"window.openFilesInNewWindow": "off",
"workbench.editor.enablePreview": false

"workbench.editor.enablePreview": false" means when you click a file it stays open. This is an optional part of this solution but I think it makes for a better DX.

"window.openFilesInNewWindow": "off" means when you open a file it will focus the tab of that file if it is already open.

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