Visual Studio for Mac:新编辑器的主要功能

At the core of the updated editors within Visual Studio for Mac is the shared language service with Visual Studio on Windows. What this means is that the same backend that powers the Windows version of Visual Studio now powers the macOS version as well. This includes IntelliSense, Roslyn, text logic, and all the language services behind the scenes. The only portion not shared between Windows and macOS is the UI layer, which stays native for each platform. In the case of macOS, that means using macOS frameworks like Cocoa and CoreText to power the UI experience. By using a native UI, while also being able to utilize support for native input methods as well as support for right-to-left languages, font ligatures and other advanced graphical features.

Visual Studio for Mac中更新的编辑器的核心是与Windows上的Visual Studio共享的语言服务。 这意味着,支持Windows版本的Visual Studio的后端现在也支持macOS版本。 这包括IntelliSense,Roslyn,文本逻辑以及所有的语言服务。 Windows和macOS之间唯一不共享的部分是UI层,该层对于每个平台都保持本机状态。 对于macOS,这意味着使用诸如Cocoa和CoreText之类的macOS框架来增强UI体验。 通过使用本机UI,同时还能够利用对本机输入法的支持以及对从右到左语言,字体连字和其他高级图形功能的支持。

This article in our blog.

本文在我们的博客中

Now that we have the power of the new editor in the IDE, let’s take a look at my top 5 favorite new editor features. All of the features I want to share with you today are aimed at making your development experience more productive, delightful and fun. I hope you enjoy using them as much as we enjoyed developing them!

现在我们有了IDE中新编辑器的强大功能,下面让我们看看我最喜欢的5个新编辑器功能。 我今天想与您分享的所有功能旨在使您的开发体验更加高效,有趣和有趣。 希望您喜欢我们开发它们所享受的乐趣!

多角色编辑 (Multi-Caret Editing)

Multi-caret allows you to insert any number of carets (text insertion points) within the file you are editing. This can be accomplished manually through mouse clicks with control-option-click or through the keyboard. When using the keyboard, you can utilize pattern matching to insert next matching (Option+Shift+.) or insert all matching (Option+Shift+;). You can also remove the last inserted caret with Option+Shift+, or move the last caret down with Option+Shift+/. In the below GIF, I use the Option+Shift+. hotkey to insert the next matching caret twice, allowing me to edit all three instances of «double» within this page.

多尖号允许您在正在编辑的文件中插入任意数量的尖号(文本插入点)。 这可以通过使用control-option-click的鼠标单击或键盘来手动完成。 使用键盘时,您可以利用模式匹配来插入下一个匹配项(Option + Shift +。)或插入所有匹配项(Option + Shift +;)。 您也可以使用Option + Shift +删除最后插入的插入符号,或使用Option + Shift + /向下移动最后的插入符号。 在下面的GIF中,我使用Option + Shift +。 使用热键两次插入下一个匹配的插入符号,使我可以在此页面中编辑所有三个“ double”实例。

Multi-caret editing is a very powerful feature that can greatly reduce the time associated with editing multiple lines at the same time. For example, if you need to change a prefix on several variables, or switching specific var declarations to strongly typed declarations, multi-caret editing allows you to do this with ease.

多重插入标记编辑是一项非常强大的功能,可以大大减少与同时编辑多行相关的时间。 例如,如果您需要更改多个变量的前缀,或将特定的var声明切换为强类型声明,则多插入符编辑可让您轻松实现此目的。

IntelliSense类型过滤 (IntelliSense Type Filtering)

The next feature that I want to highlight is IntelliSense Type Filtering. With IntelliSense Type Filtering, you can filter the completion list by type of completion. If, for example, you only want to see classes in your completion list, you can either click the classes icon or use the hotkey «option-c». We have a full list of types that you can filter by, in addition to their corresponding icons and hotkeys in our Visual Studio for Mac Documentation. In the GIF below, I use IntelliSense type filtering to focus my list on interfaces, structures and finally on delegates.

我要强调的下一个功能是IntelliSense类型筛选。 使用IntelliSense类型过滤,您可以按完成类型过滤完成列表。 例如,如果您只想在完成列表中查看课程,则可以单击课程图标或使用热键《选项-c》。 除了Visual Studio for Mac文档中的相应图标和热键之外,我们还提供了可以过滤的类型的完整列表。 在下面的GIF中,我使用IntelliSense类型过滤将列表集中在接口,结构以及最终委托上。

This feature really comes in handy when you can’t recall the exact name of the item you want, or simply want to focus solely on a specific type. It also works super well when combined with my next favorite feature, Show Import Items.

当您不记得想要的项目的确切名称,或者只想专注于特定类型时,此功能非常有用。 与我的下一个最喜欢的功能“显示导入项目”结合使用时,它也可以很好地工作。

显示导入项目 (Show Import Items)

Often, when I am working on a project, I can’t always recall the exact namespace I need to import into my code file for a specific type. This often leads me to panic and feverishly search anywhere I can to find the import I need. This next feature alleviates this angst by not only showing completions which I have already imported, but also completions that are available for import. Additionally, if I end up selecting one of the not-yet-imported completions, the using statement will be added to the header of the code file. In the below GIF, I add «System.ComponentModel.DataAnnotations» to my project through the Show Import Items feature. You may have also noticed that for items which are not yet imported, the full namespace is listed next to the type, making it easy to see what the system is going to add to your header.

通常,当我在一个项目上工作时,我总是无法回忆起需要导入特定类型的代码文件中的确切名称空间。 这常常使我感到恐慌,并且在任何可以找到所需进口商品的地方疯狂地搜索。 下一个功能通过不仅显示我已经导入的完成内容,而且还显示可用于导入的完成内容来减轻这种烦恼。 此外,如果最终选择了一个尚未导入的补全,则using语句将添加到代码文件的标题中。 在下面的GIF中,我通过“显示导入项”功能将“ System.ComponentModel.DataAnnotations”添加到项目中。 您可能还注意到,对于尚未导入的项目,该类型旁边列出了完整的名称空间,使您可以轻松查看系统将要添加到标题中的内容。

Show Import Items is currently disabled by default, but you can easily enable it by opening Visual Studio > Preferences > Text Editor > IntelliSense and enabling «Show Import Items».

当前默认情况下,“显示导入项目”处于禁用状态,但您可以通过以下方法轻松启用它:打开Visual Studio>“首选项”>“文本编辑器”>“ IntelliSense”并启用“显示导入项目”。

从右到左和本机输入支持 (Right-to-Left and Native Input Support)

A top ask from our community was to enable support of right-to-left and bi-directional languages, and we incredibly excited to offer support for those requests in Visual Studio 2019 for Mac. In the old editors, typing or pasting right-to-left strings, such as those in Persian, Hebrew or Arabic, would result in the word appearing to be in reverse. For example, the word for «hello» would appear to say «olleh», flipping the text around so that it appears reversed. With the new editors, right-to-left and all types of bi-directional text are supported.

我们社区的首要任务是启用从右到左和双向语言的支持,我们非常激动地为Visual Studio 2019 for Mac中的那些请求提供支持。 在旧的编辑器中,键入或粘贴从右到左的字符串(例如波斯语,希伯来语或阿拉伯语中的字符串)会导致单词看起来相反。 例如,“ hello”一词看起来像是“ olleh”,将文本翻转过来使其看起来是相反的。 使用新的编辑器,支持从右到左和所有类型的双向文本。

We’ve also introduced native input support. As the editors are built using the native toolkit for macOS, inserting text into the editor is just like inserting in any other native macOS app. This means that you get access to all of the advanced text entry features of macOS, such as long-press for accented and alternate characters as well as the emoji selector!

我们还引入了本机输入支持。 由于使用macOS的本机工具包构建了编辑器,因此向编辑器中插入文本就像在其他任何本机macOS应用程序中插入一样。 这意味着您可以访问macOS的所有高级文本输入功能,例如长按重音符号和替代字符以及表情符号选择器!

连字支持 (Ligature Support)

If you use a font which supports ligatures, such as the newly released Cascadia Code, Visual Studio for Mac 2019 will automatically support the insertion of ligatures in place of common dual character glyphs. For example, the double-equal sign (==) will be transformed into an elongated equal sign with no space. Likewise, the bang-equals (!=) will be transformed to an equal sign with a slash throughout, more accurately depicting the «does not equal» symbol which bang-equals is intended to represent.

如果使用支持连字的字体(例如新发布的Cascadia代码),则Visual Studio for Mac 2019将自动支持插入连字代替常见的双字符字形。 例如,双等号(==)将转换为没有空间的细长等号。 同样,bang-equals(!=)将被转换为带有斜线的等号,更准确地描绘了Bang-equals旨在表示的“不等于”符号。

In the below GIF, I use a simple «if» statement to demonstrate the available ligatures for several different common multi-character glyphs.

在下面的GIF中,我使用一个简单的“ if”语句来演示几种不同的常见多字符字形的可用连字。

下载适用于Mac的Visual Studio 2019 (Download Visual Studio 2019 for Mac)

These are my five favorite editors features in Visual Studio for Mac 2019, but there are plenty more to experience as you work through a project. To get started with Visual Studio 2019 for Mac Download the Visual Studio 2019 for Mac v8.3 release today, or if you have it installed already – update to the latest release using the Stable channel!

这些是Visual Studio for Mac 2019中我最喜欢的五个编辑器功能,但是当您完成一个项目时,还有更多的体验。 要开始使用Visual Studio 2019 for Mac,请立即下载Visual Studio 2019 for Mac v8.3版本 ,或者如果您已经安装了Visual Studio 2019,请 使用稳定通道更新到最新版本

If you run into any issues with the v8.3 release, please use the Help > Report a Problem menu in the IDE to let us know about it. You can also provide suggestions for future improvements by using the Provide a Suggestion menu.

如果您在v8.3发行版中遇到任何问题,请使用IDE中的“帮助”> “报告问题”菜单来告知我们。 您还可以通过使用“提供建议”菜单提供建议,以供将来进行改进。

Finally, make sure to follow us on Twitter at @VisualStudioMac to stay up to date on the latest Visual Studio for Mac news and let us know what your experience has been like. We look forward to hearing from you!

最后,请确保在Twitter上@VisualStudioMac上关注我们,以了解Mac上最新的Visual Studio最新消息,并让我们知道您的体验如何。 我们期待您的回音!

翻译自: https://habr.com/en/company/microsoft/blog/470045/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值