#pragma once #include #include #include #include #include #include namespace vls::features::code_actions { 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 Edit { Range range; std::string replacement; auto operator<=>(const Edit &) const = default; }; // One compiler-suggested fix: its title, the file it edits and its edits. struct Fix { std::string title; std::string path; std::vector edits; }; struct Action { std::string title; std::string path; std::vector edits; auto operator<=>(const Action &) const = default; }; struct Limits { std::size_t actions{64}; std::size_t edits{8}; std::size_t titleBytes{256}; std::size_t editBytes{4096}; }; // Keeps fixes with at least one edit intersecting the requested range, drops // empty or malformed fixes, deduplicates identical edits and actions, and // bounds every field. Order is the input order. [[nodiscard]] std::vector actions(std::span, Range requested, const Limits & = Limits{}); } // namespace vls::features::code_actions