﻿// 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.Composition;
using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.PickMembers;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.PickMembers;

namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Internal.PickMembers
{
    [Shared]
    [ExportWorkspaceService(typeof(IPickMembersService), ServiceLayer.Host)]
    internal class OmniSharpPickMembersService : IPickMembersService
    {
        private readonly IOmniSharpPickMembersService _omniSharpPickMembersService;

        [ImportingConstructor]
        [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
        public OmniSharpPickMembersService(IOmniSharpPickMembersService omniSharpPickMembersService)
        {
            _omniSharpPickMembersService = omniSharpPickMembersService;
        }

        public PickMembersResult PickMembers(string title, ImmutableArray<ISymbol> members, ImmutableArray<PickMembersOption> options = default)
        {
            var result = _omniSharpPickMembersService.PickMembers(title, members, options.SelectAsArray(o => new OmniSharpPickMembersOption(o)), selectAll: true);
            return new(result.Members, result.Options.SelectAsArray(o => o.PickMembersOptionInternal));
        }
    }
}

﻿// 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.Composition;
using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.PickMembers;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.PickMembers;

namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Internal.PickMembers
{
    [Shared]
    [ExportWorkspaceService(typeof(IPickMembersService), ServiceLayer.Host)]
    internal class OmniSharpPickMembersService : IPickMembersService
    {
        private readonly IOmniSharpPickMembersService _omniSharpPickMembersService;

        [ImportingConstructor]
        [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
        public OmniSharpPickMembersService(IOmniSharpPickMembersService omniSharpPickMembersService)
        {
            _omniSharpPickMembersService = omniSharpPickMembersService;
        }

        public PickMembersResult PickMembers(string title, ImmutableArray<ISymbol> members, ImmutableArray<PickMembersOption> options = default, bool selectAll = true)
        {
            var result = _omniSharpPickMembersService.PickMembers(title, members, options.SelectAsArray(o => new OmniSharpPickMembersOption(o)), selectAll);
            return new(result.Members, result.Options.SelectAsArray(o => o.PickMembersOptionInternal), result.SelectedAll);
        }
    }
}

Revert "Fix up for 16.11"
Revert "Fix up for 16.11"

This reverts commit 28955d0f02e5e369dbac824f167cd87c8fd1dfb3.
