简体   繁体   English

如何将 Visual Studio Code 中的面板移动到右侧?

[英]How do I move the panel in Visual Studio Code to the right side?

It's at the bottom by default.它默认位于底部。

For example in the following image,panel(Section D) is at the bottom, instead I want it to move to the rightside ie, in the area where README.md editior shown in Editor Groups(Section C).例如在下图中,面板(D 部分)位于底部,而我希望它移动到右侧,即在编辑器组(C 部分)中显示 README.md editior 的区域。 在此处输入图像描述

Image Credits: ( https://code.visualstudio.com/images/codebasics_hero.png )图片来源:( https://code.visualstudio.com/images/codebasics_hero.png

As of October 2018 (version 1.29) the button in @mvvijesh's answer no longer exists.截至 2018 年 10 月(版本 1.29),@mvvijesh 的答案中的按钮不再存在。

You now have 2 options.您现在有 2 个选择。 Right click the panel's toolbar (nowhere else on the panel will work) and choose "move panel right/bottom":右键单击面板的工具栏(面板上的其他任何地方都不起作用)并选择“向右/底部移动面板”:

Or choose " View: Toggle Panel Position " from the command palette.或者从命令面板中选择“查看:切换面板位置”。

Source: VSCode update notes: https://code.visualstudio.com/updates/v1_29#_panel-position-button-to-context-menu来源:VSCode 更新说明: https ://code.visualstudio.com/updates/v1_29#_panel-position-button-to-context-menu

For people looking for an answer (on how to move the side panel):对于寻找答案的人(关于如何移动侧面板):

You can press你可以按

ctrl + , (Or cmd + , on OSX) ctrl + , (或cmd + ,在 OSX 上)

and add the following option to your user settings JSON file:并将以下选项添加到您的用户设置 JSON 文件中:

"workbench.sideBar.location": "right"

左侧边栏

I'm using Visual Studio Code v1.24.0 on a Mac.我在 Mac 上使用 Visual Studio Code v1.24.0。

By default, the Panel will appear on the bottom (You can change the default as well. Please refer to @Forres' answer: Moving Panel in Visual Studio Code to right side )默认情况下,面板将出现在底部(您也可以更改默认设置。请参阅@Forres 的回答: 将 Visual Studio Code 中的面板移动到右侧

Here's the bottom/right toggle button for VS Code Panel:这是 VS Code 面板的底部/右侧切换按钮:

在此处输入图片说明

Once I click on this button, the Panel moves to the right.单击此按钮后,面板会向右移动。

在此处输入图片说明

Moving it back is a little tricky though.不过把它移回去有点棘手。 As you can see, some of the buttons are hidden.如您所见,有些按钮是隐藏的。 This is because the width of the panel when it's aligned right is too small.这是因为面板右对齐时的宽度太小。 We need to expand the column to see all the buttons.我们需要展开列以查看所有按钮。

This is how it'll look upon expansion:这是它在扩展时的样子:

在此处输入图片说明

Now, if you want to move the Panel back to the bottom, click on the toggle bottom/top button again.现在,如果要将面板移回底部,请再次单击底部/顶部切换按钮。

单击菜单选项View > Appearance > Move Side Bar Right或在 settings.json 中:

"workbench.panel.defaultLocation": "right"

Click menu option View > Appearance > Move to Side Bar Right .单击菜单选项View > Appearance > Move to Side Bar Right Once side bar moves to right, option "Move Side Bar Right" changes to "Move to Side Bar Left".一旦侧栏向右移动,选项“向右移动侧栏”将更改为“向左移动侧栏”。

As of June 2019 this setting can be found through searching 'Panel' - if you want to change the default there is an option for it as shown in the screenshot:截至 2019 年 6 月,可以通过搜索“面板”找到此设置 - 如果您想更改默认设置,则有一个选项,如屏幕截图所示: 在此处输入图片说明

For Visual Studio Code v1.31.1, you can toggle the panel session via the View menu.对于 Visual Studio Code v1.31.1,您可以通过“视图”菜单切换面板会话。

  • Go to the View Menu.进入查看菜单。
  • Via the Appearance option, click on Toggle Panel Position通过外观选项,单击Toggle Panel Position

在此处输入图片说明

Hope this will help someone.希望这会帮助某人。

-> open to keyboard shortcut -> 打开键盘快捷键

-> search for "workbench.action.togglePanelPosition" -> 搜索“workbench.action.togglePanelPosition”

-> assign your desired shortcut -> 分配你想要的快捷方式

I've assigned keybinding "cmd+`"我已经分配了键绑定“cmd+`”

{
  "key": "cmd+`",
  "command": "workbench.action.togglePanelPosition"
}

now I can toggle the terminal by pressing "cmd + `"现在我可以通过按“cmd + `”来切换终端

VSCode 1.42 (January 2020) introduces: VSCode 1.42 (2020 年 1 月)引入:

Panel on the left/right左侧/右侧面板

The panel can now be moved to the left side of the editor with the setting:现在可以使用以下设置将面板移动到编辑器的左侧:

 "workbench.panel.defaultLocation": "left"

This removes the command View: Toggle Panel Position ( workbench.action.togglePanelPosition ) in favor of the following new commands:这将删除命令View: Toggle Panel Position ( workbench.action.togglePanelPosition ) 以支持以下新命令:

  • View: Move Panel Left ( workbench.action.positionPanelLeft ) View: Move Panel Leftworkbench.action.positionPanelLeft
  • View: Move Panel Right ( workbench.action.positionPanelRight ) View: Move Panel Rightworkbench.action.positionPanelRight
  • View: Move Panel To Bottom ( workbench.action.positionPanelBottom ) View: Move Panel To Bottomworkbench.action.positionPanelBottom

You can do the same in insider's edition, There is an option on right top corner to switch to the panel to sidebar https://code.visualstudio.com/insiders/您可以在 Insider 版本中执行相同操作,右上角有一个选项可以切换到侧边栏的面板https://code.visualstudio.com/insiders/

terminal at the bottom side底部的终端底部的终端

terminal at the right side右侧的终端右侧的终端

右侧带有终端的 vscode 屏幕截图

This answer is for people that just want their terminal on the right side (shown above), and don't care about the panel.这个答案适用于那些只希望终端位于右侧(如上所示)而不关心面板的人。

  1. Show vscode's Command Palette with keyboard shortcut command + shift + p or ctrl + shift + p使用键盘快捷键command + shift + pctrl + shift + p显示 vscode 的命令面板
  2. Type in "terminal editor"输入“终端编辑器”
  3. Choose option that says Terminal: Create New Terminal in Editor Area to the Side选择Terminal: Create New Terminal in Editor Area to the Side选项

In version 1.55.2.在 1.55.2 版本中。

Go to View --> Appearance --> Move Panel Right转到查看 --> 外观 --> 向右移动面板在此处输入图片说明

我不知道它从哪个版本开始更改,但 1.11.2 在“视图”选项卡中有一个选项,可以将左栏向右更改,反之亦然

As sample as this from the GUI.作为 GUI 中的示例。 View->Appearance->Move Side Bar Right查看->外观->向右移动侧栏

在此处输入图片说明

"workbench.panel.defaultLocation": "right",

Go to Command Palette from the wheel icon on the bottom left --> search and enter "settings" menu --> search "panel" in the search bar --> Select Default location as "right" instead of the "bottom".从左下角的滚轮图标转到命令面板--> 搜索并输入“设置”菜单--> 在搜索栏中搜索“面板”--> 选择默认位置为“右侧”而不是“底部”。 Reload VS Code, and you're good to go.重新加载 VS Code,你就可以开始了。

By default, ⌘J toggles the (bottom) panel.默认情况下, ⌘J切换(底部)面板。 If all your views are on the side panel, make ⌘J toggle the side panel by doing:如果您的所有视图都在侧面板上,请通过执行⌘J切换侧面板:

Code > Preferences > Keyboard Shortcuts > "Command+J" > Right-click > Remove Keybinding代码>首选项>键盘快捷键>“Command+J”>右键单击>删除键绑定

Code > Preferences > Keyboard Shortcuts > View: Toggle Side Panel > Add Keybinding > ⌘J代码 > 首选项 > 键盘快捷键 > 查看:切换侧面板 > 添加键绑定 > ⌘J

"Wokbench.panel.defaultLocation": "right"

Open settings using CTRL+.使用CTRL+.打开设置CTRL+. , search for terminal and you should see this setting at the top. ,搜索terminal ,您应该会在顶部看到此设置。 From the drop down below the settings explanation, choose right .从设置说明下方的下拉列表中,选择right See the screenshot below.请参阅下面的屏幕截图。

在此处输入图片说明

Go to view , then appearence .view ,然后appearence Then select move panel bottom.然后选择移动面板底部。

As of Stable v1.64 the setting "Wokbench.panel.defaultLocation": "right" will no longer work.从 Stable v1.64 开始,设置"Wokbench.panel.defaultLocation": "right"将不再起作用。

Replacing Panel Location更换面板位置

As mentioned above, the new Side Panel provides similar functionality as moving the Panel to the left or right, yet improves on this by not forcing the move of the original panel.如上所述,新的侧面板提供了与向左或向右移动面板类似的功能,但通过不强制移动原始面板来改进这一点。 Along with view drag and drop between panels, the new Side Panel is replacing the option to move the bottom Panel.随着面板之间的视图拖放,新的侧面板正在取代移动底部面板的选项。

In light of that, we have deprecated the workbench.panel.defaultLocation setting as well as the Move Panel... commands in favor of similar commands Move Views From Panel To Side Panel ( workbench.action.movePanelToSidePanel ) and Move Views From Side Panel To Panel ( workbench.action.moveSidePanelToPanel ).鉴于此,我们弃用了workbench.panel.defaultLocation设置以及移动面板workbench.action.movePanelToSidePanel到面板( workbench.action.moveSidePanelToPanel )。 The old commands will remap to the appropriate new command providing the similiar behavior.旧命令将重新映射到提供类似行为的适当新命令。 Though, we recommend updating your keybindings to the new commands.不过,我们建议您将键绑定更新为新命令。

面板位置

This is in favor of using the new Side Panel , which can be in addition to the previous Side Bar (where the Explorer, SCM views traditionally are) and the Panel (where Terminal, Output, etc. traditionally are).这有利于使用新的Side Panel ,它可以添加到以前的Side Bar (资源管理器、SCM 视图传统上所在的位置)和面板(终端、输出等传统上所在的位置)。 So you can have 3 panel-types of views.因此,您可以拥有3种面板类型的视图。 See more at the v1.64 Release Notes: https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_64.md#new-side-panel在 v1.64 发行说明中查看更多信息: https ://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_64.md#new-side-panel

The panel opens on the right by default.默认情况下,面板在右侧打开。

Note that this setting needs to be in a new folder to take effect.请注意,此设置需要在新文件夹中才能生效。

If VSCode has opened the folder before, the panel will still use the old location.如果 VSCode 之前打开过该文件夹,面板仍将使用旧位置。

"workbench.panel.defaultLocation": "right",

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM