Formatting Style in RazorView-Files


I noticed that I have an issue with the formating of my code in razor view files.
I use the "At end of Line (K&R style)" setting for my bracers layout and setup the align settings to always get something like this

public UnityControllerFactory(IUnityContainer unityContainer) {
     if (unityContainer == null) {
          throw new ArgumentException();
     this._unityContainer = unityContainer;

I expected to have a similar result when editing razor view files however I get results like that

@foreach (var instrument in Model.Instruments) {
                                                               var contracts = Model.Contracts.Where(c => c.InstrumentId == instrument.Id).ToList();
                                                               if (contracts.Count == 0) {
                                                               foreach (var contract in contracts) {
                                                                                                              var member = Model.Members.FirstOrDefault(m => m.Id == contract.MemberId);

It seems the statement after the opening brace gets not intended as usually. Is there some way to change this behaviour? In cs files this is working fine.
Please note that I setup a tabstop equals two spaces so it added a lot of tabs which isn't diplayed properly here.

Kind regards,

1 comment
Comment actions Permalink

Does anybody else have the same issue?


I have seen this is already tracked :)


Please sign in to leave a comment.