예제 #1
0
            public override void EnterFunctionDefinition(PhpParser.FunctionDefinitionContext context)
            {
                var codeBlock = context.codeBlock();

                if (codeBlock != null)
                {
                    _outliningTrees.Add(context.codeBlock());
                }
            }
예제 #2
0
            private static string GetName([NotNull] PhpParser.FunctionDefinitionContext 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);
            }
예제 #3
0
            public override void EnterFunctionDefinition(PhpParser.FunctionDefinitionContext context)
            {
                string name = GetName(context);
                IEnumerable <string> args = ProcessArguments(context.functionParameterList());
                string sig = string.Format("{0}({1})", name, string.Join(", ", args));
                IEditorNavigationType navigationType = _provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(PredefinedEditorNavigationTypes.Members);
                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 = StandardGlyphGroup.GlyphGroupMethod;
                //StandardGlyphItem glyphItem = GetGlyphItemFromChildModifier(tree);
                StandardGlyphItem     glyphItem = StandardGlyphItem.GlyphItemPublic;
                ImageSource           glyph     = _provider.GlyphService.GetGlyph(glyphGroup, glyphItem);
                NavigationTargetStyle style     = NavigationTargetStyle.None;

                _navigationTargets.Add(new EditorNavigationTarget(sig, navigationType, span, seek, glyph, style));
            }
예제 #4
0
 public override void EnterFunctionDefinition(PhpParser.FunctionDefinitionContext context)
 {
     _navigationTrees.Add(context);
 }