private List<Line> parseLines(FromSourceLocation source) {
        SourceLocation location = source.getSourceLocation();
        int line = location.getLine();

        if (source instanceof ValidationEvent) {
            ValidationEvent event = (ValidationEvent) source;
            Shape targetShape = event.getShapeId().flatMap(model::getShape).orElse(null);
            if (targetShape != null) {
                if (targetShape.getSourceLocation().equals(location)) {
                    // The validation event is on a shape since the location is equal to the shape location.
                    source = targetShape;
                } else if (targetShape.getSourceLocation().getLine() > location.getLine()) {
                    // Assume it's a trait in the Smithy IDL. Show the trait definition followed by shape definition.
                    return parseTraitBeforeShape(location, targetShape);
                } else if (location.getFilename().endsWith(".json")) {
                    // Assume it's a trait defined in JSON. Show the trait definition followed by shape definition.
                    return parseTraitAfterShape(location, targetShape);
                } else {
                    // It's a trait that uses "apply" or the location is invalid, so just show the trait line.
                    return Collections.singletonList(lines.get(line - 1));
                }
            }
        }

        if (source instanceof MemberShape) {
            return parseMemberShape(location, (MemberShape) source);
        }

        return parseOtherComponents(location);
    }
This class loads model files into memory, one at a time, and either shows leading lines up to a source location or
shows lines that are relevant to a source location use context from a {@link Model}.

<p>Sort sequences of {@link SourceLocation}s before calling {@link #loadContext(FromSourceLocation)} to avoid
needing to open and parse the same file more than once.

@see SourceContextLoader#createLineBasedLoader
@see SourceContextLoader#createModelAwareLoader
smithy-model/src/main/java/software/amazon/smithy/model/loader/sourcecontext/DefaultSourceLoader.java