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)); }
private static string GetName(PhpParser.FunctionParameterContext context) { Contract.Requires(context != null); ITerminalNode nameNode = context.PHP_IDENTIFIER(); if (nameNode == null) return "?"; string name = nameNode.Symbol.Text; if (string.IsNullOrEmpty(name)) return "?"; return name; }
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)); }