#pragma once #include #include #include #include #include #include namespace vls::features::document_links { struct Position { std::uint32_t line{}, character{}; auto operator<=>(const Position &) const = default; }; struct Range { Position start, end; auto operator<=>(const Range &) const = default; }; // A quoted include resolved lexically against the document's directory. struct Link { Range range; // the spelling inside the quotes std::string path; auto operator<=>(const Link &) const = default; }; struct Limits { std::size_t links{256}; std::size_t pathBytes{4096}; std::size_t scanBytes{8 * 1024 * 1024}; }; // Quoted include directives in TEXT resolved from DOCUMENT_PATH's directory. // Angle includes are skipped because their search roots are unknown, and a // directive without a terminated spelling on its line is skipped. The result // is bounded; existence on disk is the caller's check. [[nodiscard]] std::vector includes(std::string_view text, std::string_view document_path, const Limits & = Limits{}); } // namespace vls::features::document_links