【问题标题】:VS .EditorConfig file not overriding VS Options DialogVS .EditorConfig 文件不覆盖 VS 选项对话框
【发布时间】:2019-04-17 11:04:17
【问题描述】:

documentation 中表示 .EditorConfig 文件(我的突出显示)

EditorConfig 文件与代码库而非 Visual Studio 个性化帐户相关联。 EditorConfig 文件中的设置优先于“选项”对话框中选择的选项。当您想要为您的 repo 或项目的所有贡献者强制执行编码样式时,请使用 EditorConfig 文件。

当我将 .EditorConfig 文件添加到解决方案时,它似乎反过来优先?

例如。文件中的以下值和我的选项的屏幕截图,.this 警告不应该在我的 IDE 中作为错误出现吗?

# this. and Me. preferences
dotnet_style_qualification_for_event = true:error
dotnet_style_qualification_for_field = true:error
dotnet_style_qualification_for_method = true:error
dotnet_style_qualification_for_property = true:error

编辑:这是它们在错误列表窗口中的显示方式

【问题讨论】:

    标签: visual-studio-2019 editorconfig


    【解决方案1】:

    .editorconfig确实优先。

    但这并没有显示在工具 |选项(仍显示您的个人资料设置)。

    当您编辑代码时,您会在错误工具窗口中看到效果(假设您启用显示消息)。

    【讨论】:

    • 这就是问题所在,它们在错误窗口中显示为警告而不是错误
    • @Xynos 我已经成功地在.editorconfig 中配置了警告和建议之间的项目。但我从未尝试过错误。由于格式化通常不会阻止编译......但实际上——如何控制格式化设置——确实是一个不同的问题。
    猜你喜欢
    • 2012-11-22
    • 2011-01-18
    • 2018-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-14
    • 2018-04-01
    相关资源
    最近更新 更多