提交 25a7354d 编写于 作者: Š Šimon Koníček

Passing in existing syntax facts service

上级 d57e0620
......@@ -44,7 +44,7 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex
if (IsTokenOfIfStatement(token, out var ifStatement) &&
IsFirstStatementOfIfStatement(syntaxFacts, ifStatement, out var parentIfStatement) &&
await CanBeMergedAsync(context.Document, parentIfStatement, ifStatement, context.CancellationToken))
await CanBeMergedAsync(context.Document, syntaxFacts, parentIfStatement, ifStatement, context.CancellationToken))
{
context.RegisterRefactoring(
new MyCodeAction(
......@@ -97,12 +97,11 @@ private async Task<Document> FixAsync(Document document, TextSpan span, ISyntaxF
private async Task<bool> CanBeMergedAsync(
Document document,
ISyntaxFactsService syntaxFacts,
TIfStatementSyntax outerIfStatement,
TIfStatementSyntax innerIfStatement,
CancellationToken cancellationToken)
{
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
if (!GetElseClauses(outerIfStatement).SequenceEqual(GetElseClauses(innerIfStatement), syntaxFacts.AreEquivalent))
{
return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册