提交 40cd810f 编写于 作者: C CyrusNajmabadi

Move code.

上级 d27a0114
......@@ -217,6 +217,21 @@ public sealed override Task OnDefinitionFoundAsync(DefinitionItem definition)
protected abstract Task OnDefinitionFoundWorkerAsync(DefinitionItem definition);
protected async Task<(Guid, SourceText)> GetGuidAndSourceTextAsync(Document document)
{
// The FAR system needs to know the guid for the project that a def/reference is
// from (to support features like filtering). Normally that would mean we could
// only support this from a VisualStudioWorkspace. However, we want till work
// in cases lke Any-Code (which does not use a VSWorkspace). So we are tolerant
// when we have another type of workspace. This means we will show results, but
// certain features (like filtering) may not work in that context.
var workspace = document.Project.Solution.Workspace as VisualStudioWorkspaceImpl;
var guid = workspace?.GetHostProject(document.Project.Id)?.Guid ?? Guid.Empty;
var sourceText = await document.GetTextAsync(CancellationToken).ConfigureAwait(false);
return (guid, sourceText);
}
protected async Task<Entry> CreateDocumentSpanEntryAsync(
RoslynDefinitionBucket definitionBucket,
DocumentSpan documentSpan,
......@@ -531,21 +546,6 @@ void IDisposable.Dispose()
CancelSearch();
}
protected async Task<(Guid, SourceText)> GetGuidAndSourceTextAsync(Document document)
{
// The FAR system needs to know the guid for the project that a def/reference is
// from (to support features like filtering). Normally that would mean we could
// only support this from a VisualStudioWorkspace. However, we want till work
// in cases lke Any-Code (which does not use a VSWorkspace). So we are tolerant
// when we have another type of workspace. This means we will show results, but
// certain features (like filtering) may not work in that context.
var workspace = document.Project.Solution.Workspace as VisualStudioWorkspaceImpl;
var guid = workspace?.GetHostProject(document.Project.Id)?.Guid ?? Guid.Empty;
var sourceText = await document.GetTextAsync(CancellationToken).ConfigureAwait(false);
return (guid, sourceText);
}
#endregion
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册