提交 2ccd3022 编写于 作者: S Sam Harwell

Allow the formatter to report NOP text changes

上级 8a88bc97
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Options;
......@@ -51,8 +50,9 @@ internal static void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context, Diagno
if (change.NewText.Length == 0 && change.Span.IsEmpty)
{
// No actual change
throw new InvalidOperationException("This program location is thought to be unreachable.");
// No actual change (allows for the formatter to report a NOP change without triggering a
// diagnostic that can't be fixed).
continue;
}
var location = Location.Create(tree, change.Span);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册