2021-10-30 04:25:12 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Luau/DenseHash.h"
|
|
|
|
#include "Luau/Variant.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace Luau
|
|
|
|
{
|
|
|
|
|
|
|
|
struct FunctionDocumentation;
|
|
|
|
struct TableDocumentation;
|
|
|
|
struct OverloadedFunctionDocumentation;
|
2021-11-20 00:10:07 +08:00
|
|
|
struct BasicDocumentation;
|
2021-10-30 04:25:12 +08:00
|
|
|
|
2021-11-20 00:10:07 +08:00
|
|
|
using Documentation = Luau::Variant<BasicDocumentation, FunctionDocumentation, TableDocumentation, OverloadedFunctionDocumentation>;
|
2021-10-30 04:25:12 +08:00
|
|
|
using DocumentationSymbol = std::string;
|
|
|
|
|
2021-11-20 00:10:07 +08:00
|
|
|
struct BasicDocumentation
|
|
|
|
{
|
|
|
|
std::string documentation;
|
|
|
|
std::string learnMoreLink;
|
2022-02-18 09:18:01 +08:00
|
|
|
std::string codeSample;
|
2021-11-20 00:10:07 +08:00
|
|
|
};
|
|
|
|
|
2021-10-30 04:25:12 +08:00
|
|
|
struct FunctionParameterDocumentation
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
DocumentationSymbol documentation;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Represents documentation for anything callable. This could be a method or a
|
|
|
|
// callback or a free function.
|
|
|
|
struct FunctionDocumentation
|
|
|
|
{
|
|
|
|
std::string documentation;
|
|
|
|
std::vector<FunctionParameterDocumentation> parameters;
|
|
|
|
std::vector<DocumentationSymbol> returns;
|
2021-11-20 00:10:07 +08:00
|
|
|
std::string learnMoreLink;
|
2022-02-18 09:18:01 +08:00
|
|
|
std::string codeSample;
|
2021-10-30 04:25:12 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct OverloadedFunctionDocumentation
|
|
|
|
{
|
|
|
|
// This is a map of function signature to overload symbol name.
|
|
|
|
Luau::DenseHashMap<std::string, DocumentationSymbol> overloads;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Represents documentation for a table-like item, meaning "anything with keys".
|
|
|
|
// This could be a table or a class.
|
|
|
|
struct TableDocumentation
|
|
|
|
{
|
|
|
|
std::string documentation;
|
|
|
|
Luau::DenseHashMap<std::string, DocumentationSymbol> keys;
|
2021-11-20 00:10:07 +08:00
|
|
|
std::string learnMoreLink;
|
2022-02-18 09:18:01 +08:00
|
|
|
std::string codeSample;
|
2021-10-30 04:25:12 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
using DocumentationDatabase = Luau::DenseHashMap<DocumentationSymbol, Documentation>;
|
|
|
|
|
|
|
|
} // namespace Luau
|