未验证 提交 e48eb8e1 编写于 作者: M Manish Vasani 提交者: GitHub

Merge pull request #23492 from mavasani/DocumentDIfferencing

Enable execution of well known batch fixer from non-VS host
// 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.Collections.Immutable;
using System.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis
{
[ExportWorkspaceService(typeof(IDocumentTextDifferencingService), ServiceLayer.Default), Shared]
internal class DefaultDocumentTextDifferencingService : IDocumentTextDifferencingService
{
public async Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken)
......
......@@ -661,5 +661,16 @@ public void TestChangeDocumentInfo_TryApplyChanges()
Assert.Equal(newPath, appliedDoc.FilePath);
}
}
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestDefaultDocumentTextDifferencingService()
{
using (var ws = new AdhocWorkspace())
{
var service = ws.Services.GetService<IDocumentTextDifferencingService>();
Assert.NotNull(service);
Assert.Equal(service.GetType(), typeof(DefaultDocumentTextDifferencingService));
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册