当前位置: 首页>>代码示例>>C#>>正文


C# ISymbol类代码示例

本文整理汇总了C#中ISymbol的典型用法代码示例。如果您正苦于以下问题:C# ISymbol类的具体用法?C# ISymbol怎么用?C# ISymbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ISymbol类属于命名空间,在下文中一共展示了ISymbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SourceDefinitionTreeItem

        public SourceDefinitionTreeItem(Document document, TextSpan sourceSpan, ISymbol symbol, ushort glyphIndex)
            : base(document, sourceSpan, glyphIndex)
        {
            _symbolDisplay = symbol.ToDisplayString(definitionDisplayFormat);

            this.DisplayText = $"[{document.Project.Name}] {_symbolDisplay}";
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:7,代码来源:SourceDefinitionTreeItem.cs

示例2: ShouldOmitThisDiagnostic

        private static bool ShouldOmitThisDiagnostic(ISymbol symbol, Compilation compilation)
        {
            // This diagnostic is only relevant in constructors.
            // TODO: should this apply to instance field initializers for VB?
            var m = symbol as IMethodSymbol;
            if (m == null || m.MethodKind != MethodKind.Constructor)
            {
                return true;
            }

            var containingType = m.ContainingType;
            if (containingType == null)
            {
                return true;
            }

            // special case ASP.NET and WinForms constructors
            INamedTypeSymbol webUiControlType = compilation.GetTypeByMetadataName("System.Web.UI.Control");
            if (containingType.Inherits(webUiControlType))
            {
                return true;
            }

            INamedTypeSymbol windowsFormsControlType = compilation.GetTypeByMetadataName("System.Windows.Forms.Control");
            if (containingType.Inherits(windowsFormsControlType))
            {
                return true;
            }

            return false;
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:31,代码来源:CA2214DiagnosticAnalyzer.cs

示例3: AnalyzeCodeBlock

 public void AnalyzeCodeBlock(SyntaxNode codeBlock, ISymbol ownerSymbol, SemanticModel semanticModel, Action<Diagnostic> addDiagnostic, AnalyzerOptions options, CancellationToken cancellationToken)
 {
     if (IsEmptyFinalizer(codeBlock, semanticModel))
     {
         addDiagnostic(ownerSymbol.CreateDiagnostic(Rule));
     }
 }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:7,代码来源:CA1821DiagnosticAnalyzer.cs

示例4: DefaultVisit

 public override void DefaultVisit(ISymbol symbol, MetadataItem item, SymbolVisitorAdapter adapter)
 {
     foreach (var generator in _generators)
     {
         generator.DefaultVisit(symbol, item, adapter);
     }
 }
开发者ID:yonglehou,项目名称:docfx,代码行数:7,代码来源:CompositeYamlModelGenerator.cs

示例5: GenerateSyntax

 internal override void GenerateSyntax(MemberType type, ISymbol symbol, SyntaxDetail syntax, SymbolVisitorAdapter adapter)
 {
     foreach (var generator in _generators)
     {
         generator.GenerateSyntax(type, symbol, syntax, adapter);
     }
 }
开发者ID:yonglehou,项目名称:docfx,代码行数:7,代码来源:CompositeYamlModelGenerator.cs

示例6: Create

 public static CompletionItem Create(
     string displayText,
     TextSpan span,
     ISymbol symbol,
     int contextPosition = -1,
     int descriptionPosition = -1,
     string sortText = null,
     string insertionText = null,
     Glyph? glyph = null,
     string filterText = null,
     bool preselect = false,
     SupportedPlatformData supportedPlatforms = null,
     bool isArgumentName = false,
     ImmutableDictionary<string, string> properties = null,
     CompletionItemRules rules = null)
 {
     return Create(
         displayText: displayText,
         span: span,
         symbols: ImmutableArray.Create(symbol),
         contextPosition: contextPosition,
         descriptionPosition: descriptionPosition,
         sortText: sortText,
         insertionText: insertionText,
         glyph: glyph,
         filterText: filterText,
         preselect: preselect,
         supportedPlatforms: supportedPlatforms,
         isArgumentName: isArgumentName,
         properties: properties,
         rules: rules);
 }
开发者ID:RoryVL,项目名称:roslyn,代码行数:32,代码来源:SymbolCompletionItem.cs

示例7: RunRename

 public static void RunRename(ISymbol symbol, string newName = null)
 {
     if ((symbol is IMember) && ((symbol.SymbolKind == SymbolKind.Constructor) || (symbol.SymbolKind == SymbolKind.Destructor))) {
         // Don't rename constructors/destructors, rename their declaring type instead
         symbol = ((IMember) symbol).DeclaringType.GetDefinition();
     }
     if (symbol != null) {
         var project = GetProjectFromSymbol(symbol);
         if (project != null) {
             var languageBinding = project.LanguageBinding;
             if (newName == null) {
                 RenameSymbolDialog renameDialog = new RenameSymbolDialog(name => CheckName(name, languageBinding))
                 {
                     Owner = SD.Workbench.MainWindow,
                     OldSymbolName = symbol.Name,
                     NewSymbolName = symbol.Name
                 };
                 if (renameDialog.ShowDialog() == true) {
                     newName = renameDialog.NewSymbolName;
                 } else {
                     return;
                 }
             }
             AsynchronousWaitDialog.ShowWaitDialogForAsyncOperation(
                 "${res:SharpDevelop.Refactoring.Rename}",
                 progressMonitor =>
                 FindReferenceService.RenameSymbol(symbol, newName, progressMonitor)
                 .ObserveOnUIThread()
                 .Subscribe(error => SD.MessageService.ShowError(error.Message), ex => SD.MessageService.ShowException(ex), () => {}));
         }
     }
 }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:32,代码来源:FindReferencesCommand.cs

示例8: RenameSymbolAsync

        public static async Task<Solution> RenameSymbolAsync(Solution solution, ISymbol symbol, string newName, OptionSet optionSet, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (solution == null)
            {
                throw new ArgumentNullException(nameof(solution));
            }

            if (symbol == null)
            {
                throw new ArgumentNullException(nameof(symbol));
            }

            if (string.IsNullOrEmpty(newName))
            {
                throw new ArgumentException("newName");
            }

            cancellationToken.ThrowIfCancellationRequested();

            optionSet = optionSet ?? solution.Workspace.Options;
            var renameLocationSet = await RenameLocationSet.FindAsync(symbol, solution, optionSet, cancellationToken).ConfigureAwait(false);
            var conflictResolution = await ConflictEngine.ConflictResolver.ResolveConflictsAsync(renameLocationSet, symbol.Name, newName, optionSet, cancellationToken).ConfigureAwait(false);

            return conflictResolution.NewSolution;
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:25,代码来源:Renamer.cs

示例9: FindReferencesAsync

 /// <summary>
 /// Finds all references to a symbol throughout a solution
 /// </summary>
 /// <param name="symbol">The symbol to find references to.</param>
 /// <param name="solution">The solution to find references within.</param>
 /// <param name="cancellationToken">A cancellation token.</param>
 public static Task<IEnumerable<ReferencedSymbol>> FindReferencesAsync(
     ISymbol symbol,
     Solution solution,
     CancellationToken cancellationToken = default(CancellationToken))
 {
     return FindReferencesAsync(symbol, solution, progress: null, documents: null, cancellationToken: cancellationToken);
 }
开发者ID:jerriclynsjohn,项目名称:roslyn,代码行数:13,代码来源:SymbolFinder_References.cs

示例10: GetSymbolDepth

        private int GetSymbolDepth(ISymbol symbol)
        {
            ISymbol current = symbol.ContainingSymbol;
            int depth = 0;
            while (current != null)
            {
                var namespaceSymbol = current as INamespaceSymbol;
                if (namespaceSymbol != null)
                {
                    // if we've reached the global namespace, we're already at the top; bail
                    if (namespaceSymbol.IsGlobalNamespace)
                    {
                        break;
                    }
                }
                else
                {
                    // we don't want namespaces to add to our "depth" because they won't be displayed in the tree
                    depth++;
                }

                current = current.ContainingSymbol;
            }

            return depth;
        }
开发者ID:rgmills,项目名称:SourceBrowser,代码行数:26,代码来源:DocumentGenerator.Declarations.cs

示例11: MakeSnippetedResponses

        private IEnumerable<AutoCompleteResponse> MakeSnippetedResponses(AutoCompleteRequest request, ISymbol symbol)
        {
            var completions = new List<AutoCompleteResponse>();
            var methodSymbol = symbol as IMethodSymbol;
            if (methodSymbol != null)
            {
                if (methodSymbol.Parameters.Any(p => p.IsOptional))
                {
                    completions.Add(MakeAutoCompleteResponse(request, symbol, false));
                }
                completions.Add(MakeAutoCompleteResponse(request, symbol));
                return completions;
            }
            var typeSymbol = symbol as INamedTypeSymbol;
            if (typeSymbol != null)
            {
                completions.Add(MakeAutoCompleteResponse(request, symbol));

                if (typeSymbol.TypeKind != TypeKind.Enum)
                {
                    foreach (var ctor in typeSymbol.InstanceConstructors)
                    {
                        completions.Add(MakeAutoCompleteResponse(request, ctor));
                    }
                }
                return completions;
            }
            return new[] { MakeAutoCompleteResponse(request, symbol) };
        }
开发者ID:tugberkugurlu,项目名称:omnisharp-roslyn,代码行数:29,代码来源:OmnisharpController.Intellisense.cs

示例12: GenerateHyperlinkToReferences

        public HtmlElementInfo GenerateHyperlinkToReferences(ISymbol symbol, bool isLargeFile = false)
        {
            string symbolId = SymbolIdService.GetId(symbol);

            string referencesFilePath = Path.Combine(ProjectDestinationFolder, Constants.ReferencesFileName, symbolId + ".html");
            string href = Paths.MakeRelativeToFile(referencesFilePath, documentDestinationFilePath);
            href = href.Replace('\\', '/');

            var result = new HtmlElementInfo
            {
                Name = "a",
                Attributes =
                {
                    { "id", symbolId },
                    { "href", href },
                    { "target", "n" },
                },
                DeclaredSymbol = symbol,
                DeclaredSymbolId = symbolId
            };

            if (!isLargeFile)
            {
                var dataGlyph = string.Format("{0},{1}",
                    SymbolIdService.GetGlyphNumber(symbol),
                    GetSymbolDepth(symbol));
                result.Attributes.Add("data-glyph", dataGlyph);
            }

            return result;
        }
开发者ID:rgmills,项目名称:SourceBrowser,代码行数:31,代码来源:DocumentGenerator.Declarations.cs

示例13: RenameLocations

 internal RenameLocations(ISet<RenameLocation> locations, ISymbol symbol, Solution solution, IEnumerable<ISymbol> referencedSymbols, IEnumerable<ReferenceLocation> implicitLocations, OptionSet options)
 {
     _symbol = symbol;
     _solution = solution;
     _mergedResult = new SearchResult(locations, implicitLocations, referencedSymbols);
     Options = options;
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:RenameLocations.cs

示例14: ParseDocumentation

        public SDLanguageItemCollection<SDDocumentation> ParseDocumentation(ISymbol symbol)
        {
            var documentationXml = symbol.GetDocumentationCommentXml();
            var docDic = new SDLanguageItemCollection<SDDocumentation>();
            if (!string.IsNullOrEmpty(documentationXml))
            {
                var xml = XDocument.Parse($"<doc>{documentationXml}</doc>");
                foreach (var child in xml.Descendants())
                {
                    var isoCode = child.Name.LocalName.ToLower();
                    if (CultureInfo.GetCultures(CultureTypes.NeutralCultures).Any(c => c.TwoLetterISOLanguageName == isoCode) || isoCode == "default")
                    {
                        // TODO
                        //_sdRepository.AddDocumentationLanguage(child.Name.ToLower());
                        var languageDoc = ParseDocumentation(child.Descendants(), true);
                        if(!docDic.ContainsKey(isoCode)) docDic.Add(isoCode, languageDoc);
                    }
                }

                //Es wurde keine Sprachunterstützung in der Doku genutzt.
                //Deswegen wird die Doku einfach als "default" geladen.
                if (docDic.Count == 0)
                {
                    var defaultDoc = ParseDocumentation(xml.Descendants());
                    docDic.Add("default", defaultDoc);
                }
            }
            return docDic;
        }
开发者ID:Geaz,项目名称:sharpDox,代码行数:29,代码来源:DocumentationParser.cs

示例15: CreatePartialCompletionData

		public CreatePartialCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, int declarationBegin, ITypeSymbol currentType, ISymbol member, bool afterKeyword) : base (keyHandler, factory, member)
		{
			this.afterKeyword = afterKeyword;
			this.currentType = currentType;
			this.declarationBegin = declarationBegin;
			this.GenerateBody = true;
		}
开发者ID:swarkcn,项目名称:monodevelop,代码行数:7,代码来源:CreatePartialCompletionData.cs


注:本文中的ISymbol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。