#pragma once #include #include #include #include #include #include #include namespace vls::features::formatting { 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; }; // LSP formatting options, bounded by the server before they get here. struct Options { std::uint32_t tab_size{4}; bool insert_spaces{true}; }; struct Limits { std::size_t outputBytes{32 * 1024 * 1024}; std::size_t tabSize{64}; }; // clang-format arguments. With FILE_STYLE the workspace .clang-format is used // (--style=file); otherwise the LSP options become an explicit LLVM-based // style. The path only names the file, nothing is read from it here. [[nodiscard]] std::vector arguments(const Options &, std::string_view path, bool file_style, const Limits & = Limits{}); // A single whole-document replacement when the formatted text differs, or // nothing when it is identical or exceeds the bound. The range end covers the // last character of the original text. [[nodiscard]] std::vector edits(std::string_view original, std::string_view formatted, const Limits & = Limits{}); } // namespace vls::features::formatting