protected override void Visit(UsingChunk chunk) { var documentContent = ((Span)chunk.Association).Content.Trim(); var mapSemicolon = false; if (documentContent.LastOrDefault() == ';') { mapSemicolon = true; } ImportedUsings.Add(chunk.Namespace); // Depending on if the user has a semicolon in their @using statement we have to conditionally decide // to include the semicolon in the line mapping. using (Writer.BuildLineMapping(chunk.Start, documentContent.Length, Context.SourceFile)) { Writer.WriteUsing(chunk.Namespace, endLine: false); if (mapSemicolon) { Writer.Write(";"); } } if (!mapSemicolon) { Writer.WriteLine(";"); } }
protected override void Visit(UsingChunk chunk) { if (chunk == null) { throw new ArgumentNullException(nameof(chunk)); } // We don't want to attempt to add duplicate namespace imports. if (!_addedImports.Add(chunk.Namespace)) { return; } var documentContent = ((Span)chunk.Association).Content.Trim(); var documentLocation = new MappingLocation(chunk.Start, documentContent.Length); var importNamespace = new ImportNamespace { // TODO: The document content has the entire "using X" string, this only has the X. Are mapping locations accurate? Namespace = chunk.Namespace, DocumentLocation = documentLocation }; _context.Builder.Add(importNamespace); }
protected override void Visit(UsingChunk chunk) { }
protected virtual void Visit(UsingChunk chunk) { }
protected abstract void Visit(UsingChunk chunk);