自定义 IDECustomizing the IDE

可以自定义 Visual Studio for Mac,因此用户可以在同时满足效率和美观需求的环境中开发应用。Visual Studio for Mac can be customized, allowing users to develop apps in an environment that meets their needs for both efficiency and aesthetics. 本文将探讨调整 Visual Studio for Mac 的各种方式以满足你的需要。This article explores the variety of ways that Visual Studio for Mac can be adapted to suit your needs.

深色主题Dark theme


通过浏览到“Visual Studio”>“首选项”>“环境”>“视觉样式”并从“用户界面主题”下拉列表中选择所需主题,可以切换 Visual Studio for Mac 的主题,如下图中所示 :You can switch themes in Visual Studio for Mac by browsing to Visual Studio > Preferences > Environment > Visual Style and selecting your desired theme from the User Interface Theme drop-down, as illustrated in the following image:



Visual Studio for Mac 已采用以下 14 种语言进行本地化,便于更多开发人员使用:Visual Studio for Mac is localized in the following 14 languages, enabling it to be accessible to more developers:

  • 简体中文 - 中国Chinese - China
  • 繁体中文 - 中国台湾Chinese - Taiwan
  • 捷克语Czech
  • 法语French
  • 德语German
  • 英语English
  • 意大利语Italian
  • 日语Japanese
  • 韩语Korean
  • 波兰语Polish
  • 葡萄牙语 - 巴西Portuguese - Brazil
  • 俄语Russian
  • 西班牙语Spanish
  • 土耳其语Turkish

若要更改 Visual Studio for Mac 显示的语言,请浏览到“Visual Studio”>“首选项”>“环境”>“视觉样式”并从“用户界面语言”下拉列表中选择所需语言,如下图中所示 :To change the language displayed by Visual Studio for Mac, browse to Visual Studio > Preferences > Environment > Visual Style and select your desired language from the User Interface Language drop-down, as illustrated in the following image:


创建者信息Author information

在创建者信息面板中,可以添加你的相关信息,例如名字、电子邮件地址、作品的版权所有者、所在公司和商标:The author information panel allows you to add relevant information about yourself such as your name, email address, the copyright owner for your work, your company, and trademark:


此信息用于填充标准文件标头(如许可证),这些标头可能会添加到新文件中:This information is used to populate standard file headers, such as a license, that you might add to new files:


填充的“名称” 和“电子邮件” 字段用于通过 Visual Studio for Mac 的版本控制完成的任何提交。Populated Name and Email fields will be used in any commit that is made through Version Control in Visual Studio for Mac. 若尚未填充这些字段,Visual Studio for Mac 将在你尝试使用版本控制时提示你进行此操作。If you haven't populated these fields, Visual Studio for Mac will prompt you to do so when you try to use Version Control.

键绑定Key bindings

通过键绑定或键盘快捷方式,可以调整开发环境,使得在 Visual Studio for Mac 中的移动更高效。Key bindings, or keyboard shortcuts, allow you to adapt your development environment so that you can move more efficiently throughout Visual Studio for Mac. 它为许多常用 IDE(如 Visual Studio (on Windows)、ReSharper、Visual Studio Code 和 Xcode)提供熟悉的键绑定。It provides familiar key bindings for many popular IDEs, such as Visual Studio (on Windows), ReSharper, Visual Studio Code, and Xcode.

通过浏览到“Visual Studio”>“首选项”>“环境”>“键绑定”可以设置键绑定,如下图中所示 :Key bindings can be set by browsing to Visual Studio > Preferences > Environment > Key Bindings, as illustrated by the following image:


从此处可以搜索键绑定组合、查看冲突绑定、添加新绑定和编辑现有绑定。From here you can search for key binding combinations, view conflicting bindings, add new bindings, and edit the existing bindings.

也可以在 Visual Studio for Mac 的初始设置过程中通过“键盘选择”屏幕来设置这些绑定 :These bindings can also be set during the initial setup of Visual Studio for Mac, via the Keyboard Selection screen:


工作区布局Workspace layout

Visual Studio for Mac 的工作区由主要文档区域(通常是编辑器、设计器图面或选项文件)组成,周围是包含用于访问和管理应用程序文件、测试和调试的有用信息的免费面板 。Visual Studio for Mac's workspace consists of a main document area (normally the editor, designer surface, or options file), surrounded by complimentary pads that contain useful information for accessing and managing application files, testing, and debugging.


查看和排列面板Viewing and arranging pads

在 Visual Studio for Mac 中打开任何新解决方案或文件时,应注意工作区中的一些面板 ,包括 Solution Pad、文档大纲和错误:When you open any new solution or file in Visual Studio for Mac, you should notice some pads in the workspace, including the Solution Pad, Document Outline, and Errors:

Solution Pad

Visual Studio for Mac 提供包含其他信息、工具和导航帮助的面板,通过浏览到“视图”>“面板”菜单项可以访问这些面板,选择一个面板进行添加: Visual Studio for Mac provides pads containing additional information, tools, and navigation aids, all of which can be accessed by browsing to the View > Pads menu item and selecting a pad to add it:


也可以通过各种命令自动打开面板,例如“在文件中查找”(Shift + Cmd + F) 命令会打开搜索结果的独立面板 。Pads may also be opened automatically by various commands, such as the Find in Files (Shift + Cmd + F) command, which opens a detached pad of search results.

可以最有用的任何方式在工作流中移动和排列面板。Pads can be moved and arranged throughout your workflow in whatever way is most useful to you. 例如,它们可以停靠在文档编辑器的任意一侧,可以与另一个面板相邻,也可以在另一个面板的上方或下方,或者作为一组选项卡式面板,能够在面板之间快速切换。For example, they can be docked on any side of the document editor, adjacent to another pad, above or below another pad, or as a set of tabbed pads enabling you to quickly switch between them.

对于频繁使用的面板,也可以将其从 Visual Studio for Mac 窗口完全拆离,然后为该面板单独创建一个窗口。For frequently used pads, you can also completely detach a pad from the Visual Studio for Mac window, and create a separate window for that pad.

通过每个面板右上角的切换隐藏和关闭面板:Pads can be hidden and closed by the toggles in the top-right corner of each pad:


自动隐藏的面板会停靠在工作区的一侧,以便需要时轻松访问。Autohidden pads are docked to the sides of the workspace making them easily accessible when they are required. 将鼠标悬停在面板上会再次显示面板,当鼠标和键盘焦点离开面板时会隐藏面板。Hovering over the pad displays it again, and it will be hidden when the mouse and keyboard focus leaves it.

组织布局Organizing layouts

随时都可以显示的面板依赖于当前的上下文。The pads that are displayed at any time are dependent on the current context. 例如,当使用可视化设计器时,工具箱和属性网格面板是最重要的;在调试时,能够使用调试器面板查看堆栈和局部变量将十分有用。For example, when using the visual designer, the toolbox and property grid pads are most important; when debugging, it is useful to have the debugger pads for viewing the stack and locals.

打开面板的状态由“布局”表示 。The state of the open pads is represented by a layout. 可以通过“视图”菜单手动切换布局,如下图中所示,或执行调试或打开 Storyboard 等操作时会自动切换布局:The layouts can be switched manually through the View menu, as illustrated in the following image, or it is switched automatically when you carry out an action, such as debugging, or opening a Storyboard:


始终存在一个活动布局,对布局做出的任何更改(如添加或重新定位填充)只会更改活动布局。There is always one active layout and any change you make in a layout, such as adding or repositioning a pad, will only change the active layout. 一旦关闭 Visual Studio for Mac,将不会保存做出的更改。Once you close Visual Studio for Mac, the changes you have made will not be saved.

然而,可以使用“视图”>“保存当前布局”菜单项来创建新布局 。However, it is possible to create a new layout by using the View > Save Current Layout menu item. 此命令会将当前布局添加到菜单,以供随时选择:This command will add your current layout to the menu so that you can select it at any time:


并行编辑支持Side-by-side editing support

通过 Visual Studio for Mac,可以并行打开文本编辑器,或让一个编辑器作为独立的浮动窗口。Visual Studio for Mac allows you to open text editors side by side, or to have an editor as a detached floating window.

通过选择“视图”>“编辑器列”>“2 列”,用“视图”菜单项启用 2 列模式,或通过将编辑器选项卡拖动到编辑器区域的一个边缘来启用该模式 :Two-column mode can be enabled through the View menu item by selecting View > Editor Columns > 2 columns, or by dragging an editor tab to one of the edges of the editor area:

2 列并行模式

可以将编辑器选项卡拖动到文档区域外,从而创建浮动编辑器窗口。Editor tabs can be dragged out of the document area to create a floating editor window. 该浮动窗口也支持并行编辑器,并可以包含多个编辑器选项卡:This floating window also supports side-by-side editors, and can contain several editor tabs:


与其他选项卡并行的 2 列

若要还原单一的打开编辑器,请选择“视图”>“编辑器列”>“1 列” 。To revert to a single open editor, select View > Editor Columns > 1 column.

另请参阅See also