提交 16c73afb 编写于 作者: A Allison Chou

DefinitionText changes

上级 5d60af1f
......@@ -85,10 +85,20 @@ public async override Task OnDefinitionFoundAsync(DefinitionItem definition)
// Assinging a new id to the definition
_definitionToId.Add(definition, _id);
// VSReferenceItem currently doesn't support the ClassifiedTextElement type for DefinitionText,
// so for now we just pass in a string.
// https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1100009
var classifiedText = definition.GetClassifiedText();
var definitionText = "";
foreach (var text in classifiedText.Runs)
{
definitionText += text.Text;
}
// Creating a new VSReferenceItem for the definition
var definitionItem = await GenerateVSReferenceItemAsync(
_id, definitionId: _id, _document, _position, definition.SourceSpans.FirstOrDefault(),
definition.DisplayableProperties, _metadataAsSourceFileService, definition.GetClassifiedText(),
definition.DisplayableProperties, _metadataAsSourceFileService, definitionText,
symbolUsageInfo: null, CancellationToken).ConfigureAwait(false);
if (definitionItem.Location != null)
......@@ -141,7 +151,7 @@ private void AddAndReportResultsIfAtMax(VSReferenceItem item)
DocumentSpan documentSpan,
ImmutableDictionary<string, string> properties,
IMetadataAsSourceFileService metadataAsSourceFileService,
ClassifiedTextElement? definitionText,
string? definitionText,
SymbolUsageInfo? symbolUsageInfo,
CancellationToken cancellationToken)
{
......
......@@ -56,10 +56,6 @@ public FindAllReferencesHandler(IMetadataAsSourceFileService metadataAsSourceFil
await findUsagesService.FindReferencesAsync(document, position, context).ConfigureAwait(false);
await context.OnCompletedAsync().ConfigureAwait(false);
// This is a temporary workaround to report the last batch of results until an LSP bug is fixed:
// https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1094786/
Thread.Sleep(500);
// The results have already been reported to the client, so we don't need to return anything here.
return Array.Empty<LSP.VSReferenceItem>();
}
......
......@@ -9,7 +9,6 @@
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
......@@ -22,7 +21,6 @@
using Microsoft.VisualStudio.LanguageServer.Client;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.Utilities.Internal;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Roslyn.Utilities;
using StreamJsonRpc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册