2023-04-24 23:46:55 -04:00
|
|
|
#pragma once
|
|
|
|
|
2023-05-28 13:22:00 -04:00
|
|
|
#include <optional>
|
2023-04-24 23:46:55 -04:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "tree_sitter/api.h"
|
|
|
|
|
|
|
|
namespace formatter {
|
2023-06-04 13:19:29 -04:00
|
|
|
|
2023-04-24 23:46:55 -04:00
|
|
|
struct TreeSitterParserDeleter {
|
|
|
|
void operator()(TSParser* ptr) const { ts_parser_delete(ptr); }
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TreeSitterTreeDeleter {
|
|
|
|
void operator()(TSTree* ptr) const { ts_tree_delete(ptr); }
|
|
|
|
};
|
|
|
|
|
2023-05-28 13:22:00 -04:00
|
|
|
std::optional<std::string> format_code(const std::string& source);
|
2023-04-24 23:46:55 -04:00
|
|
|
} // namespace formatter
|