0

Have an annoying visual studio auto-complete behavior.

When editing an MVC view (cshtml) when typing href= Visual studio will autocomplete to "help me out" by auto completing the quotes, for example href="". The problem is with MVC the majority of my links are generated dynamically using @Url.Action(...).

If there a way to control this auto editing? A minor thing but it disrupt my flow every single time, enough that I posted the question.

Gerald Davis
  • 4,541
  • 2
  • 31
  • 47

1 Answers1

3

Why don't you just add Url.Action inside quotes. Like href="@Url.Action(...)".

Or if you want to disable automatic quotes look here Turn off automatic quote insertion in Visual Studio 2010 is the same in Visual Studio 2013.

Community
  • 1
  • 1
Jernej Novak
  • 3,165
  • 1
  • 33
  • 43
  • 2
    Adding the Url.Action with double quotes is the way to generate correct HTML markup, else you get a anchor tag that looks like `Link` which is not syntactically valid – Tommy Nov 26 '13 at 19:27
  • @Tommy it appear both href=@Url.Action(...) and href="@Url(...).Action" produce the same html. MVC is "fixing" up the quote tags regardless. It was just a bad assumption onmy part. Since href=@Url.Action(...) produces valid html I assumed that adding quotes would end up with double quotation but that isn't the case. – Gerald Davis Dec 09 '13 at 22:56
  • @Jerney Novak Seems silly but I assumed that would produce invalid html but that isn't the case. Answer accepted. – Gerald Davis Dec 09 '13 at 22:57