If you have stuggled to get outlining (Visual Studio’s ability to collapse/expand sections of a document) working when editing master pages there is a very simple solution. You will notice that some options such as line numbering, when toggled on/off for the HTML editor, are visible when editing master pages. However, there is something ‘special’ about master pages that prevents all the standard HTML editor settings applying (or functioning) correctly with them. As such, Visual Studio provides a Master Page Editior which solves these issues, yay!
Unfortunately, by default master pages are opened using the HTML editor rather than the Master Page editor. To get around this please take the following actions:
1. Right click a master page to open via the solution explorer:
2. Click ‘Open with…’
3. Select ‘Master Page Editor’
4. Click ‘Set as Default’
5. Click ‘Ok’

If you have been playing around under ‘Tools > Options > Text Editor’ and explicity assigning the master extension to the HTML editor (or anything similar) in a futile attempt to get this working, remember to undo your changes as they may interfere with lauching the Master Page Editor by default option.