未验证 提交 57235f49 编写于 作者: B Ben Lichtman 提交者: GitHub

Handle null IGoToDefinitionService in peek

Currently, the `PeekableItemSource` assumes that if a language exports an `IGoToDefinitionService`, then it's non-null - however, this is incorrect, and can cause a null reference exception dialog in VS.

Here, we gracefully handle the potential null.
上级 5f182ed2
......@@ -67,6 +67,11 @@ public void AugmentPeekSession(IPeekSession session, IList<IPeekableItem> peekab
// For documents without semantic models, just try to use the goto-def service
// as a reasonable place to peek at.
var goToDefinitionService = document.GetLanguageService<IGoToDefinitionService>();
if (goToDefinitionService == null)
{
return;
}
var navigableItems = goToDefinitionService.FindDefinitionsAsync(document, triggerPoint.Value.Position, cancellationToken)
.WaitAndGetResult(cancellationToken);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册