Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge release/dev16.11-vs-deps to main-vs-deps #53732

Merged
merged 2 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ stages:
sourcePath: '$(Build.SourcesDirectory)\artifacts\OptProf\$(BuildConfiguration)\Data'
toLowerCase: false
usePat: false
retentionDays: 90
displayName: 'OptProf - Publish to Artifact Services - ProfilingInputs'
condition: succeeded()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Navigation;
using Microsoft.CodeAnalysis.GoToDefinition;
using Microsoft.CodeAnalysis.Shared.Extensions;

namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.GoToDefinition
{
internal static class OmniSharpFindDefinitionService
{
internal static async Task<ImmutableArray<OmniSharpNavigableItem>> FindDefinitionsAsync(Document document, int position, CancellationToken cancellationToken)
{
var service = document.GetRequiredLanguageService<IFindDefinitionService>();
var result = await service.FindDefinitionsAsync(document, position, cancellationToken).ConfigureAwait(false);
return result.NullToEmpty().SelectAsArray(original => new OmniSharpNavigableItem(original.DisplayTaggedParts, original.Document, original.SourceSpan));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.InlineHints;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.InlineHints
{
internal static class OmniSharpInlineHintsService
{
public static async Task<ImmutableArray<OmniSharpInlineHint>> GetInlineHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken)
{
var service = document.GetRequiredLanguageService<IInlineHintsService>();
var hints = await service.GetInlineHintsAsync(document, textSpan, cancellationToken).ConfigureAwait(false);
return hints.SelectAsArray(static h => new OmniSharpInlineHint(
h.Span,
h.DisplayParts,
(document, cancellationToken) => h.GetDescriptionAsync(document, cancellationToken)));
}
}

internal readonly struct OmniSharpInlineHint
{
private readonly Func<Document, CancellationToken, Task<ImmutableArray<TaggedText>>> _getDescriptionAsync;

public OmniSharpInlineHint(
TextSpan span,
ImmutableArray<TaggedText> displayParts,
Func<Document, CancellationToken, Task<ImmutableArray<TaggedText>>> getDescriptionAsync)
{
Span = span;
DisplayParts = displayParts;
_getDescriptionAsync = getDescriptionAsync;
}

public readonly TextSpan Span { get; }
public readonly ImmutableArray<TaggedText> DisplayParts { get; }

public Task<ImmutableArray<TaggedText>> GetDescrptionAsync(Document document, CancellationToken cancellationToken)
=> _getDescriptionAsync.Invoke(document, cancellationToken);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Navigation
{
internal readonly struct OmniSharpNavigableItem
{
public OmniSharpNavigableItem(ImmutableArray<TaggedText> displayTaggedParts, Document document, TextSpan sourceSpan)
{
DisplayTaggedParts = displayTaggedParts;
Document = document;
SourceSpan = sourceSpan;
}

public ImmutableArray<TaggedText> DisplayTaggedParts { get; }

public Document Document { get; }

public TextSpan SourceSpan { get; }
}
}