VS Code - 在活动栏中切换搜索图标,从面板移动或向后移动 [英] VS Code - toggle search icon in Activity Bar, move from panel or back

查看:33
本文介绍了VS Code - 在活动栏中切换搜索图标,从面板移动或向后移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不小心删除了活动栏中的搜索图标,不知道如何再次添加.如果我点击活动栏,我就不会再看到这个选项了.

解决方案

更新:v1.44 您现在可以简单地拖动许多视图,包括搜索"从侧边栏到面板再返回.请参阅

另请注意,您不再右键单击侧边栏中搜索输入下方的空白区域,而是在 Search 标题本身上/附近右键单击以显示切换选项.

作为 v1.42 版本的一部分,下面提到的 search.location 设置将被弃用.

<块引用>

您的设置应该会自动迁移,但您需要使用将搜索视图向前移动的新通用方法.你不需要启用上面的实验预览设置移动带有新上下文菜单条目的搜索视图.

所以我认为不再有设置,您只需右键单击标题文本搜索",无论它是在面板中还是在侧边栏中处于活动状态以移动它.请参阅下面的演示.

如果您在侧栏中有移动到面板",请右键单击搜索"标题.

如果搜索"在面板中,请右键单击搜索"一词以移至侧边栏".

此时要启用移动输出视图,您需要启用workbench.view.experimental.allowMovingToNewContainer.

<小时>

有一个新的未绑定命令 workbench.view.search.moveView,您可以使用它在面板和侧边栏之间切换搜索位置.但请注意,在我的测试中,它只能工作几次,因为当您将搜索移动到侧边栏时它会聚焦面板 - 我会提交一个错误.

<小时>

上一个答案::

您可能修改了设置:

"search.location": "sidebar",

这是替代方案的默认值

"search.location": "面板",

这会将搜索小部件作为另一个选项卡放入终端面板.

<小时>

从 vscode v1.35 左右开始,您现在可以在搜索视图下方的空白区域(即在打开的搜索输入下的侧栏中)右键单击,您将获得一个切换搜索视图位置的选项.

搜索视图的这个上下文菜单切换是持久的.它会自动将此设置添加到您的 settings.json:

 "search.location": "面板",

目前(但请参阅下面的编辑)将图标移回活动栏(从而跨文件搜索功能到侧边栏)的唯一方法是将该设置更改为侧边栏 选项.或在设置编辑器中查找此设置:

<块引用>

搜索:位置

控制搜索是否显示为视图在侧边栏中或作为面板区域中的面板以获得更多水平空间.

编辑:最近,vscode 添加了在面板中时右键单击搜索区域以将其切换回侧边栏的功能.

I accidentally removed search icon in Activity Bar and don't know how to add it there again. If I click on Activity Bar, I don't see this option any more.

解决方案

Update: v1.44 you can now simply drag many of the views, including "Search" from the sidebar to the panel and back. See https://code.visualstudio.com/updates/v1_44#_increased-view-placement-flexibility and https://stackoverflow.com/a/55981465/836330


Update: v1.42 added a context menu option

Move to Panel/Move to Sidebar

to certain typically sidebar views like Search, Outline and custom views. So you wouldn't have to use a setting to move the Search view back to the sidebar. Here is a demo:

Also notice that you no longer right-click in the empty space below the search inputs in the sidebar but on/near the Search header itself to bring up the toggle option.

As part of the v1.42 release the search.location setting mentioned below will be deprecated.

Your setting should migrate automatically, but you will need to use the new generalized method to move the Search view going forward. You do not need to enable the experimental preview setting above in order to move the Search view with the new context menu entry.

So I don't think there is a setting anymore, you just right-click on the header text "Search" whether it is in the Panel or active in the Sidebar to move it. See the demo below.

Right-click on the "Search" header if you have it in the sidebar to "Move to Panel".

If Search is in the panel, right-click on the word Search to "Move to Sidebar".

To enable moving the Output view at this point, you need to enable workbench.view.experimental.allowMovingToNewContainer.


There is a new unbound command workbench.view.search.moveView which you can use to toggle the search position between the panel and sidebar. But note that in my testing it only works a couple of times because it focuses the panel when you move search to the sidebar - I'll file a bug.


Previous Answer::

You may have modified the setting:

"search.location": "sidebar",

which is the default to the alternative

"search.location": "panel", 

which would put the search widget into the terminal panel as another tab.


As of vscode v1.35 or so, you can now right-click in the empty space below the search view (i.e., in the sidebar under the open search inputs) and you will get an option to Toggle Search View Position.

This context menu switch of the search view is persistent. It will automatically add this setting to your settings.json:

  "search.location": "panel",

The only way at present (but see edit just below) to move the icon back to the activity bar (and thus the search across files functionality to the sidebar) is to change that setting to the sidebar option. Or look for this setting in the settings editor:

Search: Location

Controls whether the search will be shown as a view in the sidebar or as a panel in the panel area for more horizontal space.

EDIT: More recently, vscode added the abilty to right-click in the search area when it is in the panel to toggle it back to the sidebar.

这篇关于VS Code - 在活动栏中切换搜索图标,从面板移动或向后移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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