/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/VisualStudio/Core/Def/Utilities/SymbolViewModel.cs
50 строк
2 KB
Cyrus Najmabadi
Remove unnecessary nullable directives
25 мар 2025, 20:43
25 мар 2025, 20:43
1636dd8
Код
Авторство
О чём код?
// 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.Windows.Media; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.VisualStudio.Language.Intellisense; namespace Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; internal class SymbolViewModel<T> : AbstractNotifyPropertyChanged where T : ISymbol { private readonly IGlyphService _glyphService; public T Symbol { get; } private static readonly SymbolDisplayFormat s_symbolDisplayFormat = new( genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters, memberOptions: SymbolDisplayMemberOptions.IncludeParameters, parameterOptions: SymbolDisplayParameterOptions.IncludeType | SymbolDisplayParameterOptions.IncludeParamsRefOut | SymbolDisplayParameterOptions.IncludeOptionalBrackets, miscellaneousOptions: SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers | SymbolDisplayMiscellaneousOptions.UseSpecialTypes | SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier); private static readonly SymbolDisplayFormat s_symbolAutomationFormat = new( genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters, memberOptions: SymbolDisplayMemberOptions.IncludeParameters, parameterOptions: SymbolDisplayParameterOptions.IncludeType | SymbolDisplayParameterOptions.IncludeParamsRefOut | SymbolDisplayParameterOptions.IncludeOptionalBrackets, kindOptions: SymbolDisplayKindOptions.IncludeTypeKeyword, miscellaneousOptions: SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers | SymbolDisplayMiscellaneousOptions.UseSpecialTypes | SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier); public SymbolViewModel(T symbol, IGlyphService glyphService) { Symbol = symbol; _glyphService = glyphService; _isChecked = true; } private bool _isChecked; public bool IsChecked { get => _isChecked; set => SetProperty(ref _isChecked, value); } public string SymbolName => Symbol.ToDisplayString(s_symbolDisplayFormat); public ImageSource Glyph => Symbol.GetGlyph().GetImageSource(_glyphService); public string SymbolAutomationText => Symbol.ToDisplayString(s_symbolAutomationFormat); }