#pragma once #include #include #include #include #include namespace vls::features::structure { struct Position { std::uint32_t line{}, character{}; auto operator<=>(const Position &) const = default; }; struct Range { Position start, end; auto operator<=>(const Range &) const = default; }; struct Folding { std::uint32_t start_line{}, end_line{}; std::string_view kind; // "comment", "region", "imports" or empty auto operator<=>(const Folding &) const = default; }; struct Limits { std::size_t selectionDepth{8}; std::size_t scanBytes{1024 * 1024}; std::size_t folds{4096}; std::size_t positions{256}; }; // Innermost first: the identifier at the position, its line, each enclosing // brace block (only openings within the bounded window) and the whole // document. Consecutive duplicates are removed. [[nodiscard]] std::vector selection_chain(std::string_view text, Position, const Limits & = Limits{}); // Multi-line brace blocks, block comments, grouped line comments, #if/#endif // and #region/#endregion pairs, and include groups, in source order and // bounded. Braces inside literals or comments never open a block. [[nodiscard]] std::vector folding_ranges(std::string_view text, const Limits & = Limits{}); } // namespace vls::features::structure