提交 76091e36 编写于 作者: M Manish Vasani

Address PR feedback

上级 69d422b7
......@@ -860,7 +860,7 @@ public async Task TestAnalyzerConfigFile_Properties()
using (var workspace = CreateWorkspace())
{
var document = new TestHostDocument("public class C { }");
var analyzerConfigDoc = new TestHostDocument("some text");
var analyzerConfigDoc = new TestHostDocument("root = true");
var project1 = new TestHostProject(workspace, name: "project1", documents: new[] { document }, analyzerConfigDocuments: new[] { analyzerConfigDoc });
workspace.AddTestProject(project1);
......@@ -876,7 +876,7 @@ public async Task TestAnalyzerConfigFile_Properties()
var analyzerConfigDocument = project.GetAnalyzerConfigDocument(analyzerConfigDoc.Id);
Assert.Equal("some text", (await analyzerConfigDocument.GetTextAsync()).ToString());
Assert.Equal("root = true", (await analyzerConfigDocument.GetTextAsync()).ToString());
}
}
......@@ -919,8 +919,8 @@ public async Task TestAnalyzerConfigFile_DocumentChanged()
{
using (var workspace = CreateWorkspace())
{
var startText = @"<setting value = ""goo""";
var newText = @"<setting value = ""goo1""";
var startText = @"root = true";
var newText = @"root = false";
var document = new TestHostDocument("public class C { }");
var analyzerConfigPath = PathUtilities.CombineAbsoluteAndRelativePaths(Temp.CreateDirectory().Path, ".editorconfig");
var analyzerConfigDoc = new TestHostDocument(startText, filePath: analyzerConfigPath);
......@@ -989,7 +989,7 @@ public async Task TestAnalyzerConfigFile_OpenClose()
{
using (var workspace = CreateWorkspace())
{
var startText = @"<setting value = ""goo""";
var startText = @"root = true";
var document = new TestHostDocument("public class C { }");
var analyzerConfigDoc = new TestHostDocument(startText);
var project1 = new TestHostProject(workspace, name: "project1", documents: new[] { document }, analyzerConfigDocuments: new[] { analyzerConfigDoc });
......@@ -1062,7 +1062,7 @@ public void TestAnalyzerConfigFile_AddRemove()
{
using (var workspace = CreateWorkspace())
{
var startText = @"<setting value = ""goo""";
var startText = @"root = true";
var document = new TestHostDocument("public class C { }");
var analyzerConfigDoc = new TestHostDocument(startText, "original.config");
var project1 = new TestHostProject(workspace, name: "project1", documents: new[] { document }, analyzerConfigDocuments: new[] { analyzerConfigDoc });
......@@ -1130,7 +1130,7 @@ public void TestAnalyzerConfigFile_AddRemove_FromProject()
{
using (var workspace = CreateWorkspace())
{
var startText = @"<setting value = ""goo""";
var startText = @"root = true";
var document = new TestHostDocument("public class C { }");
var analyzerConfigDoc = new TestHostDocument(startText, "original.config");
var project1 = new TestHostProject(workspace, name: "project1", documents: new[] { document }, analyzerConfigDocuments: new[] { analyzerConfigDoc });
......@@ -1184,7 +1184,7 @@ public void TestAnalyzerConfigFile_GetDocumentIdsWithFilePath()
const string docFilePath = "filePath1";
var document = new TestHostDocument("public class C { }", filePath: docFilePath);
var analyzerConfigDocFilePath = PathUtilities.CombineAbsoluteAndRelativePaths(Temp.CreateDirectory().Path, ".editorconfig");
var analyzerConfigDoc = new TestHostDocument(@"<setting value = ""goo""", filePath: analyzerConfigDocFilePath);
var analyzerConfigDoc = new TestHostDocument(@"root = true", filePath: analyzerConfigDocFilePath);
var project1 = new TestHostProject(workspace, name: "project1", documents: new[] { document }, analyzerConfigDocuments: new[] { analyzerConfigDoc });
workspace.AddTestProject(project1);
......
......@@ -23,6 +23,10 @@ Microsoft.CodeAnalysis.Solution.RemoveAnalyzerConfigDocument(Microsoft.CodeAnaly
Microsoft.CodeAnalysis.Solution.WithAnalyzerConfigDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.Text.SourceText text, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAnalyzerConfigDocumentText(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextAndVersion textAndVersion, Microsoft.CodeAnalysis.PreservationMode mode = Microsoft.CodeAnalysis.PreservationMode.PreserveValue) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.Solution.WithAnalyzerConfigDocumentTextLoader(Microsoft.CodeAnalysis.DocumentId documentId, Microsoft.CodeAnalysis.TextLoader loader, Microsoft.CodeAnalysis.PreservationMode mode) -> Microsoft.CodeAnalysis.Solution
Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.TextDocumentKind.AdditionalDocument = 1 -> Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.TextDocumentKind.AnalyzerConfigDocument = 2 -> Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.TextDocumentKind.Document = 0 -> Microsoft.CodeAnalysis.TextDocumentKind
Microsoft.CodeAnalysis.Workspace.CheckAnalyzerConfigDocumentIsInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.CheckAnalyzerConfigDocumentIsNotInCurrentSolution(Microsoft.CodeAnalysis.DocumentId documentId) -> void
Microsoft.CodeAnalysis.Workspace.OnAnalyzerConfigDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo documentInfo) -> void
......
......@@ -7,7 +7,7 @@
namespace Microsoft.CodeAnalysis.Diagnostics
{
/// <summary>
/// Represents a non source additional text.
/// An implementation of <see cref="AdditionalText"/> for the compiler that wraps a <see cref="TextDocumentState"/>.
/// </summary>
internal sealed class AdditionalTextWithState : AdditionalText
{
......
......@@ -264,7 +264,7 @@ internal TextDocumentState GetAdditionalDocumentState(DocumentId documentId)
return _projectState.GetAdditionalDocumentState(documentId);
}
internal TextDocumentState GetAnalyzerConfigDocumentState(DocumentId documentId)
internal AnalyzerConfigDocumentState GetAnalyzerConfigDocumentState(DocumentId documentId)
{
return _projectState.GetAnalyzerConfigDocumentState(documentId);
}
......
......@@ -5,8 +5,7 @@ namespace Microsoft.CodeAnalysis
/// <summary>
/// Indicates kind of a <see cref="TextDocument"/>
/// </summary>
/// <remarks>CONSIDER: Make this type public</remarks>
internal enum TextDocumentKind
public enum TextDocumentKind
{
/// <summary>
/// Indicates a regular source <see cref="CodeAnalysis.Document"/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册