Beispiel #1
0
            public override void EnterClassOrInterfaceDefinition(PhpParser.ClassOrInterfaceDefinitionContext context)
            {
                string name = GetQualifiedName(context);

                IEditorNavigationType navigationType = _provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(PredefinedEditorNavigationTypes.Types);
                var          startToken = _antlrParseResultArgs.Tokens[context.SourceInterval.a];
                var          stopToken  = _antlrParseResultArgs.Tokens[context.SourceInterval.b];
                SnapshotSpan span       = new SnapshotSpan(_snapshot, new Span(startToken.StartIndex, stopToken.StopIndex - startToken.StartIndex + 1));
                SnapshotSpan seek       = span;

                if (context.PHP_IDENTIFIER() != null)
                {
                    seek = new SnapshotSpan(_snapshot, new Span(context.PHP_IDENTIFIER().Symbol.StartIndex, 0));
                }

                StandardGlyphGroup glyphGroup;

                if (context.KW_INTERFACE() != null)
                {
                    glyphGroup = StandardGlyphGroup.GlyphGroupInterface;
                }
                else
                {
                    glyphGroup = StandardGlyphGroup.GlyphGroupClass;
                }

                //StandardGlyphItem glyphItem = GetGlyphItemFromChildModifier(child);
                StandardGlyphItem     glyphItem = StandardGlyphItem.GlyphItemPublic;
                ImageSource           glyph     = _provider.GlyphService.GetGlyph(glyphGroup, glyphItem);
                NavigationTargetStyle style     = NavigationTargetStyle.None;

                _navigationTargets.Add(new EditorNavigationTarget(name, navigationType, span, seek, glyph, style));
            }
Beispiel #2
0
            public override void EnterClassOrInterfaceDefinition(PhpParser.ClassOrInterfaceDefinitionContext context)
            {
                var codeBlock = context.codeBlock();

                if (codeBlock != null)
                {
                    _outliningTrees.Add(context.codeBlock());
                }
            }
Beispiel #3
0
            private static string GetQualifiedName(PhpParser.ClassOrInterfaceDefinitionContext context)
            {
                string name = GetName(context);

                for (RuleContext parent = context.Parent; parent != null; parent = parent.Parent)
                {
                    var defContext = parent as PhpParser.ClassOrInterfaceDefinitionContext;
                    if (defContext != null)
                    {
                        name = GetName(defContext) + "." + name;
                    }
                }

                return(name);
            }
Beispiel #4
0
            private static string GetName([NotNull] PhpParser.ClassOrInterfaceDefinitionContext context)
            {
                Debug.Assert(context != null);

                ITerminalNode nameNode = context.PHP_IDENTIFIER();

                if (nameNode == null)
                {
                    return("?");
                }

                string name = nameNode.Symbol.Text;

                if (string.IsNullOrEmpty(name))
                {
                    return("?");
                }

                return(name);
            }
Beispiel #5
0
 public override void EnterClassOrInterfaceDefinition(PhpParser.ClassOrInterfaceDefinitionContext context)
 {
     _navigationTrees.Add(context);
 }