VS中插值字符串的热键或自动扩展 [英] HotKey or Auto-Expansion for Interpolated Strings in VS

查看:92
本文介绍了VS中插值字符串的热键或自动扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VS 2015/2017中键入C#插值字符串时,我想节省一些按键操作.

据我所知,没有任何内置功能.<​​/p>

此处有一些相关的问题:自动插值字符串

我现在正在使用AHK脚本,该脚本使ctrl+[成为VS中的热键.我想知道是否有人知道更好的方法?

#SingleInstance force
#IfWinActive, ahk_exe devenv.exe
^[::
SendInput,$"

我还考虑了下面的脚本来直接扩展$的类型,但这会阻碍$的类型.

#SingleInstance force
#IfWinActive, ahk_exe devenv.exe
:*:$::$"

解决方案

您可以将IDE行为直接添加到脚本中

#SingleInstance force
#IfWinActive, ahk_exe devenv.exe
^[::
SendInput,$""{Left}

如果这不能回答您的问题,请为非VS用户添加有关您要实现的目标的更多信息

I want to save myself a few keystrokes when typing C# interpolated strings in VS 2015/2017.

From what I can see, there isn't any built in functionality for this.

Somewhat related question here: Automatic interpolated strings

I'm settling on an AHK script for now that makes ctrl+[ a hotkey for this in VS. I'm wondering if anyone knows of a better way?

#SingleInstance force
#IfWinActive, ahk_exe devenv.exe
^[::
SendInput,$"

I also considered the script below to directly expand the typing of $, but this would hinder the typing of $ on its own.

#SingleInstance force
#IfWinActive, ahk_exe devenv.exe
:*:$::$"

解决方案

You can add the IDE behavior directly to the script

#SingleInstance force
#IfWinActive, ahk_exe devenv.exe
^[::
SendInput,$""{Left}

If this doesn't answer your question please add more information for non VS users about what you are trying to achieve

这篇关于VS中插值字符串的热键或自动扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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