提交 7c9b4026 编写于 作者: C CyrusNajmabadi

Filter out null values.

上级 4e999e94
......@@ -16,7 +16,7 @@ public class CommentTests : AbstractSyntaxStructureProviderTests
{
protected override string LanguageName => LanguageNames.CSharp;
internal override async Task<ImmutableArray<BlockSpan>> GetBlockSpansAsync(Document document, int position)
internal override async Task<ImmutableArray<BlockSpan>> GetBlockSpansWorkerAsync(Document document, int position)
{
var root = await document.GetSyntaxRootAsync();
var trivia = root.FindTrivia(position, findInsideTrivia: true);
......
......@@ -21,7 +21,7 @@ public class InvalidIdentifierStructureTests : AbstractSyntaxStructureProviderTe
protected override string LanguageName => LanguageNames.CSharp;
protected override string WorkspaceKind => CodeAnalysis.WorkspaceKind.MetadataAsSource;
internal override async Task<ImmutableArray<BlockSpan>> GetBlockSpansAsync(Document document, int position)
internal override async Task<ImmutableArray<BlockSpan>> GetBlockSpansWorkerAsync(Document document, int position)
{
var outliningService = document.Project.LanguageServices.GetService<BlockStructureService>();
......
......@@ -13,7 +13,7 @@ public abstract class AbstractSyntaxNodeStructureProviderTests<TSyntaxNode> : Ab
{
internal abstract AbstractSyntaxStructureProvider CreateProvider();
internal sealed override async Task<ImmutableArray<BlockSpan>> GetBlockSpansAsync(Document document, int position)
internal sealed override async Task<ImmutableArray<BlockSpan>> GetBlockSpansWorkerAsync(Document document, int position)
{
var root = await document.GetSyntaxRootAsync(CancellationToken.None);
var token = root.FindToken(position, findInsideTrivia: true);
......
......@@ -2,13 +2,14 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
using Microsoft.CodeAnalysis.Structure;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
using Xunit;
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Editor.UnitTests.Structure
{
......@@ -18,7 +19,13 @@ public abstract class AbstractSyntaxStructureProviderTests
protected virtual string WorkspaceKind => TestWorkspace.WorkspaceName;
internal abstract Task<ImmutableArray<BlockSpan>> GetBlockSpansAsync(Document document, int position);
private async Task<ImmutableArray<BlockSpan>> GetBlockSpansAsync(Document document, int position)
{
var spans = await GetBlockSpansWorkerAsync(document, position);
return spans.WhereNotNull().ToImmutableArray();
}
internal abstract Task<ImmutableArray<BlockSpan>> GetBlockSpansWorkerAsync(Document document, int position);
protected async Task VerifyBlockSpansAsync(string markupCode, params Tuple<string, string, string, bool, bool>[] expectedRegionData)
{
......
......@@ -11,7 +11,7 @@ public abstract class AbstractSyntaxTriviaStructureProviderTests : AbstractSynta
{
internal abstract AbstractSyntaxStructureProvider CreateProvider();
internal sealed override async Task<ImmutableArray<BlockSpan>> GetBlockSpansAsync(Document document, int position)
internal sealed override async Task<ImmutableArray<BlockSpan>> GetBlockSpansWorkerAsync(Document document, int position)
{
var root = await document.GetSyntaxRootAsync();
var trivia = root.FindTrivia(position, findInsideTrivia: true);
......
......@@ -15,7 +15,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Outlining
End Get
End Property
Friend Overrides Async Function GetBlockSpansAsync(document As Document, position As Integer) As Task(Of ImmutableArray(Of BlockSpan))
Friend Overrides Async Function GetBlockSpansWorkerAsync(document As Document, position As Integer) As Task(Of ImmutableArray(Of BlockSpan))
Dim root = Await document.GetSyntaxRootAsync()
Dim trivia = root.FindTrivia(position, findInsideTrivia:=True)
......
......@@ -25,7 +25,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Outlining.Metadata
End Get
End Property
Friend Overrides Async Function GetBlockSpansAsync(document As Document, position As Integer) As Task(Of ImmutableArray(Of BlockSpan))
Friend Overrides Async Function GetBlockSpansWorkerAsync(document As Document, position As Integer) As Task(Of ImmutableArray(Of BlockSpan))
Dim outliningService = document.Project.LanguageServices.GetService(Of BlockStructureService)()
Return (Await outliningService.GetBlockStructureAsync(document, CancellationToken.None)).Spans
......
......@@ -15,7 +15,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Outlining
End Get
End Property
Friend Overrides Async Function GetBlockSpansAsync(document As Document, position As Integer) As Task(Of ImmutableArray(Of BlockSpan))
Friend Overrides Async Function GetBlockSpansWorkerAsync(document As Document, position As Integer) As Task(Of ImmutableArray(Of BlockSpan))
Dim outliningService = document.Project.LanguageServices.GetService(Of BlockStructureService)()
Return (Await outliningService.GetBlockStructureAsync(document, CancellationToken.None)).Spans
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册