#pragma once #include #include #include #include #include #include namespace vls::features::outline { struct Position { std::uint32_t line{}, character{}; auto operator<=>(const Position &) const = default; }; struct Range { Position start, end; auto operator<=>(const Range &) const = default; }; // LSP SymbolKind subset this generic outline can prove from text alone. enum class Kind { namespace_ = 3, class_ = 5, method = 6, function = 12, enum_ = 10 }; struct Symbol { std::string name; Kind kind{Kind::function}; Range range; // the declaration line Range selection_range; // the name auto operator<=>(const Symbol &) const = default; }; struct Limits { std::size_t symbols{4096}; std::size_t nameBytes{256}; std::size_t scanBytes{8 * 1024 * 1024}; std::size_t lineBytes{64 * 1024}; }; // A conservative, compiler-independent outline: namespace, class/struct, // enum and function declarations recognized at the start of a physical line. // Preprocessor lines, comments and control statements are skipped, and a // call statement without a type prefix is never reported as a function. [[nodiscard]] std::vector outline(std::string_view text, const Limits & = Limits{}); } // namespace vls::features::outline