Formatting Code
In my view writing code that is easy to read and understand is
as important as writing code that works correctly. In the real
world software is developed in teams and programs typically
contain millions of lines of code that needs to be maintained
and updated constantly.
In order to make code as readable as possible it is important to
layout code consistantly. Functions should always be preceded
by one balnk line, and code inside an If or
for statement should always be indented.
In Visual Studio code can always be re-formated by selecting it and
right clicking to select Format Selection from the
context menu. Unfortunately the default formats selected by Microsoft
are not always the most readable. They can however be changed by
selecting Tools -> Options from the main menu.
The language concerned such as HTML can then be selected, and
then select Tag Specific Options. One specific
tag can then be selected and its default format changed. An
example is shown below.
Quick Editing
There are times when you need to surround some selected text with HTML tags,
for example to turn some text into a link. The quickest way is to right
click on the selected text and select Surround With from
the context menu. You can then select HTML, and then the
<a>
tag. Unfortunately not all tags are
offered in the drop down list (<strong>
for example)