提交 9d99d0a0 编写于 作者: B Ben Lichtman

Fix formatting and enable nullable

上级 57235f49
......@@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable enable
using System;
using System.Collections.Generic;
using System.Threading;
......@@ -71,7 +73,7 @@ public void AugmentPeekSession(IPeekSession session, IList<IPeekableItem> peekab
{
return;
}
var navigableItems = goToDefinitionService.FindDefinitionsAsync(document, triggerPoint.Value.Position, cancellationToken)
.WaitAndGetResult(cancellationToken);
......@@ -96,6 +98,11 @@ public void AugmentPeekSession(IPeekSession session, IList<IPeekableItem> peekab
// Get the symbol back from the originating workspace
var symbolMappingService = document.Project.Solution.Workspace.Services.GetService<ISymbolMappingService>();
if (symbolMappingService == null)
{
return;
}
var mappingResult = symbolMappingService.MapSymbolAsync(document, symbol, cancellationToken)
.WaitAndGetResult(cancellationToken);
......@@ -118,6 +125,10 @@ public void AugmentPeekSession(IPeekSession session, IList<IPeekableItem> peekab
{
var workspace = project.Solution.Workspace;
var navigationService = workspace.Services.GetService<IDocumentNavigationService>();
if (navigationService == null)
{
yield break;
}
foreach (var item in navigableItems)
{
......@@ -126,9 +137,12 @@ public void AugmentPeekSession(IPeekSession session, IList<IPeekableItem> peekab
{
var text = document.GetTextSynchronously(cancellationToken);
var linePositionSpan = text.Lines.GetLinePositionSpan(item.SourceSpan);
yield return new ExternalFilePeekableItem(
new FileLinePositionSpan(document.FilePath, linePositionSpan),
PredefinedPeekRelationships.Definitions, peekResultFactory);
if (document.FilePath != null)
{
yield return new ExternalFilePeekableItem(
new FileLinePositionSpan(document.FilePath, linePositionSpan),
PredefinedPeekRelationships.Definitions, peekResultFactory);
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册