Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I make code indentation behave correctly in vbhtml razor files?
    primarykey
    data
    text
    <p>This is driving me round the bend. I'm a long time <code>VB.NET</code> forms developer, quite new to <code>ASP.NET</code> and completely new to <code>MVC</code>. I'm creating <code>vbhtml</code> pages that use the <code>VB.NET Razor</code> syntax, and I seem to be constantly fighting against the <code>UI</code> which is trying to indent my code incorrectly. Take the following example, based on the template page for a new <code>Razor</code> view:</p> <pre><code>@Code Layout = Nothing End Code &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; @If True Then @&lt;ul&gt; @For x = 1 To 2 Next &lt;/ul&gt; End If '&lt;-- Randomly indented too far &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In the above example, as soon as I hit return after <code>Next</code>, <code>End If</code> 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.</p> <p>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 <code>HTML</code> pages but all that stops is indentation of <code>HTML</code> tags - the code blocks still slide around all over the place.</p> <p>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 <code>Microsoft</code> would release something so poor so it seems more likely I'm just not using it right.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload