FindUsagesOptions.cs 1.7 KB
Newer Older
J
Jonathon Marolf 已提交
1 2 3
// 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.
4

5
using System;
6 7
using System.Collections.Immutable;
using System.Composition;
8
using Microsoft.CodeAnalysis.Host.Mef;
9
using Microsoft.CodeAnalysis.Options;
10
using Microsoft.CodeAnalysis.Options.Providers;
11 12 13 14 15 16 17 18 19 20 21 22 23

namespace Microsoft.VisualStudio.LanguageServices.FindUsages
{
    internal static class FindUsagesOptions
    {
        private const string LocalRegistryPath = @"Roslyn\Internal\FindUsages\";

        /// <summary>
        /// Used to store the user's explicit 'grouping priority' for the 'Definition' column.
        /// We store this because we'll disable this grouping sometimes (i.e. for GoToImplementation),
        /// and we want to restore the value back to its original state when the user does the
        /// next FindReferences call.
        /// </summary>
24
        public static readonly Option<int> DefinitionGroupingPriority = new(
25 26 27
            nameof(FindUsagesOptions), nameof(DefinitionGroupingPriority), defaultValue: -1,
            storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(DefinitionGroupingPriority)));
    }
28 29 30 31

    [ExportOptionProvider, Shared]
    internal class FindUsagesOptionsProvider : IOptionProvider
    {
32
        [ImportingConstructor]
33
        [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
34 35 36 37
        public FindUsagesOptionsProvider()
        {
        }

38 39 40
        public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>(
            FindUsagesOptions.DefinitionGroupingPriority);
    }
S
Sam Harwell 已提交
41
}