简体   繁体   English

vs2010 - 用双引号包围字符串的快捷方式

[英]vs2010 - shortcut for surrounding a String by double quotes

I used to work with a developer who, selects a text in aspx page and applies a keyboard shortcut to enclose it in double quotes.我曾经与一个开发人员一起工作,他在 aspx 页面中选择一个文本并应用键盘快捷键将其括在双引号中。

Eg: runat=server.例如:运行=服务器。 when i select server and press ctrl+somekey, it should be runat="server"当我 select 服务器并按 ctrl+somekey 时,它应该是 runat="server"

Could someone tell me what is the keyboard shortcut, i tried googling a lot, but couldnt find one..谁能告诉我键盘快捷键是什么,我尝试了很多谷歌搜索,但找不到一个..

Currently we are overhauling a page, and need this badly...目前我们正在大修一个页面,并且非常需要这个......

Thanks in advance.提前致谢。

As far as I know this is a setting in Visual Studio which enables you to immediatelly place quotes when you type attribute and press equals sign or if you type a few letter and press CTRL+Space.据我所知,这是 Visual Studio 中的一个设置,它使您能够在键入属性并按等号或键入几个字母并按 CTRL+空格时立即放置引号。 This will autocomplete the attribute and place quotes.这将自动完成属性并放置引号。 In order to enable the quotes click on Tools then Options .要启用引号,请单击Tools然后Options If it is not checked, check Show all settings .如果未选中,请选中Show all settings Expand Text Editor , then HTML and click on Formatting .展开Text Editor ,然后HTML并点击Formatting On the right side enable Insert attribute values quote when typing and Insert attribute value quotes when formatting在右侧启用在键入时插入属性值引号和在格式化时插入属性值引号

Format selection: ctrl+k, ctrl+f格式选择:ctrl+k、ctrl+f

I also have Tools > Options > HTML > Formatting > Insert attribute value quotes when formatting checked.我还有工具>选项> HTML >格式> 在检查格式时插入属性值引号

I think you should try this with the replace function我认为您应该尝试使用替换 function

search: runat=server搜索:runat=服务器

replace: runat="server"替换:runat="服务器"

The developer may have been using a refactoring tool such as CodeRush or Resharper .开发人员可能一直在使用重构工具,例如CodeRushResharper Have a look at this link for how you may be able to do something similar without extra tools.查看此链接,了解如何在没有额外工具的情况下执行类似操作。

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

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