This is driving me round the bend. I'm a long time VB.NET
forms developer, quite new to ASP.NET
and completely new to MVC
. I'm creating vbhtml
pages that use the VB.NET Razor
syntax, and I seem to be constantly fighting against the UI
which is trying to indent my code incorrectly. Take the following example, based on the template page for a new Razor
view:
@Code
Layout = Nothing
End Code
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div>
@If True Then
@<ul>
@For x = 1 To 2
Next
</ul>
End If '<-- Randomly indented too far
</div>
</body>
</html>
In the above example, as soon as I hit return after Next
, End If
two lines below randomly jumps two tabs forward from where it should be. In other examples I've hit a circle where pushing one line to the correct place throws another line out of position and vice versa.
I'm so annoyed at this point I'd be happy to disable auto-indentation completely and just manage it myself, but I can't even find out how to do that! Following advice on another thread I disabled indentation for HTML
pages but all that stops is indentation of HTML
tags - the code blocks still slide around all over the place.
I thought an extension might be causing the problem but I disabled them all and restarted and the problem remains. Am I doing something fundamentally wrong? I find it hard to believe Microsoft
would release something so poor so it seems more likely I'm just not using it right.