2021-10-29 21:25:12 +01: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-19 16:10:07 +00:00
|
|
|
struct BasicDocumentation;
|
2021-10-29 21:25:12 +01:00
|
|
|
|
2021-11-19 16:10:07 +00:00
|
|
|
using Documentation = Luau::Variant<BasicDocumentation, FunctionDocumentation, TableDocumentation, OverloadedFunctionDocumentation>;
|
2021-10-29 21:25:12 +01:00
|
|
|
using DocumentationSymbol = std::string;
|
|
|
|
|
2021-11-19 16:10:07 +00:00
|
|
|
struct BasicDocumentation
|
|
|
|
{
|
|
|
|
std::string documentation;
|
|
|
|
std::string learnMoreLink;
|
2022-02-18 01:18:01 +00:00
|
|
|
std::string codeSample;
|
2021-11-19 16:10:07 +00:00
|
|
|
};
|
|
|
|
|
2021-10-29 21:25:12 +01: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-19 16:10:07 +00:00
|
|
|
std::string learnMoreLink;
|
2022-02-18 01:18:01 +00:00
|
|
|
std::string codeSample;
|
2021-10-29 21:25:12 +01: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-19 16:10:07 +00:00
|
|
|
std::string learnMoreLink;
|
2022-02-18 01:18:01 +00:00
|
|
|
std::string codeSample;
|
2021-10-29 21:25:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
using DocumentationDatabase = Luau::DenseHashMap<DocumentationSymbol, Documentation>;
|
|
|
|
|
|
|
|
} // namespace Luau
|