HotKey or Auto-Expansion for Interpolated Strings in VS

蓝咒 提交于 2019-12-02 16:50:15

问题


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
:*:$::$"

回答1:


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



来源:https://stackoverflow.com/questions/46477608/hotkey-or-auto-expansion-for-interpolated-strings-in-vs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!