public static string GetDocumentation(RobotsTxtFieldSymbol field) { string documentation; if (!BuiltInRecordDocumentations.TryGetValue(field.Name, out documentation)) { if (!ExtensionRecordDocumentations.TryGetValue(field.Name, out documentation)) { documentation = null; } } return(documentation); }
public RobotsTxtSignature(ISemanticModel model, RobotsTxtLineSyntax lineSyntax) { RobotsTxtFieldSymbol field = model.GetFieldSymbol(lineSyntax); // calculate span ITextSnapshotLine line = lineSyntax.Span.Start.GetContainingLine(); this.ApplicableToSpan = lineSyntax.Record.Document.Snapshot.CreateTrackingSpan( new SnapshotSpan( lineSyntax.NameToken.Span.Span.Start, lineSyntax.TrailingTrivia.FirstOrDefault(t => t.Span.Span.IntersectsWith(line.Extent))?.Span.Span.Start ?? line.Extent.End ), SpanTrackingMode.EdgeInclusive ); // content string content = $"{field.Name}: {ParameterName}"; if (field.IsExtension) { content = $"(extension) {content}"; } this.Content = content; // parameters this.Parameters = new ReadOnlyCollection <IParameter>( new [] { new RobotsTxtParameter(null, new Span(this.Content.LastIndexOf(ParameterName), ParameterName.Length), ParameterName, this) } ); this.CurrentParameter = this.Parameters.Single(); // documentation this.Documentation = RobotsTxtDocumentation.GetDocumentation(field); }
public static string GetParameterDocumentation(RobotsTxtFieldSymbol field) { return(null); }