提交 dfae2e65 编写于 作者: C CyrusNajmabadi

Fix perf regression in gotodef.

上级 2469edae
......@@ -61,8 +61,27 @@ internal static class GoToDefinitionHelpers
}
var definitions = ArrayBuilder<DefinitionItem>.GetInstance();
var definitionItem = symbol.ToClassifiedDefinitionItemAsync(
solution, includeHiddenLocations: true, cancellationToken: cancellationToken).WaitAndGetResult(cancellationToken);
// Going to a symbol may end up actually showing the symbol in the Find-Usages window.
// This happens when there is more than one location for the symbol (i.e. for partial
// symbols) and we don't know the best place to take you to.
//
// The FindUsages window supports showing the classified text for an item. It does this
// in two ways. Either the item can pass along its classified text (and the window will
// defer to that), or the item will have no classified text, and the window will compute
// it in the BG.
//
// Passing along the classified information is valuable for OOP scenarios where we want
// all that expensive computation done on the OOP side and not in the VS side.
//
// However, Go To Definition is all in-process, and is also synchronous. So we do not
// want to fetch the classifications here. It slows down the command and leads to a
// measurable delay in our perf tests.
//
// So, if we only have a single location to go to, this does no unnecessary work. And,
// if we do have multiple locations to show, it will just be done in the BG, unblocking
// this command thread so it can return the user faster.
var definitionItem = symbol.ToNonClassifiedDefinitionItem(solution, includeHiddenLocations: true);
if (thirdPartyNavigationAllowed)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册