Why doesn't Visual Studio code formatting work properly for Razor markup?

后端 未结 10 1650
醉梦人生
醉梦人生 2020-12-08 13:04

Or, should I rather ask, when will VS code formatting work properly for Razor markup? The formatting works for most structures, but it seems to choke on \'if\' blocks. The c

10条回答
  •  孤街浪徒
    2020-12-08 13:25

    I work with VS2017 15.9.2 and still have the problem.
    After change the editor settings to use spaces instead of tabs, the behavior in editing (e.g. copy - paste code lines) is way better, but "Format Document" still add wrong indents by every call.

    No solution, but a short update:

    It seems as the issue is solved partial in Visual Studio 2019 version 16.0 Preview 2.1
    Link to MS for the issue

    Further short update:
    I have found a (bad and ugly) workaround (to write the whole code to a razor control in ONE line. You can find the details here Workaround to wrong indentation Razor Controls

提交回复
热议问题