예제 #1
0
        public void AllClasses(OmniSharpWorkspace ws, string sourceFile)
        {
            var doc   = ws.GetDocument(sourceFile);
            var tree  = doc.GetSyntaxTreeAsync().Result;
            var model = doc.GetSemanticModelAsync().Result;

            foreach (var c in tree.GetRoot().DescendantNodes().OfType <ClassDeclarationSyntax>())
            {
                // Console.WriteLine(c.Identifier.Text);
                var fieldSymbol = model.GetDeclaredSymbol(c);

                foreach (var l in fieldSymbol.Locations)
                {
                    // Console.WriteLine(l);
                    FindSymbolAtOffset(ws, sourceFile, l.SourceSpan.Start);
                }
            }
        }
예제 #2
0
        public void AllClassMethods(OmniSharpWorkspace ws, string sourceFile)
        {
            var doc   = ws.GetDocument(sourceFile);
            var tree  = doc.GetSyntaxTreeAsync().Result;
            var model = doc.GetSemanticModelAsync().Result;

            foreach (var c in tree.GetRoot().DescendantNodes().OfType <ClassDeclarationSyntax>())
            {
                foreach (var m in c.DescendantNodes().OfType <MethodDeclarationSyntax>())
                {
                    var fieldSymbol = model.GetDeclaredSymbol(m);

                    FindSymbolAtOffset(ws, sourceFile, m.Identifier.SpanStart);

                    // Console.WriteLine($"{v.SourceSpan.Start} {v.ToString()}");
                    // Console.WriteLine($"{v.Identifier.SpanStart} - {v.Identifier.Text}");
                }
            }
        }