Initial Inlay Hint Support (#176)

This commit is contained in:
ykiko
2025-08-14 13:01:05 +08:00
committed by GitHub
parent 04cd848f3d
commit e77f182fcd
8 changed files with 1675 additions and 764 deletions

View File

@@ -5,20 +5,39 @@
#include "Index/Shared.h"
#include "Support/JSON.h"
namespace clice::config {
struct InlayHintsOptions {
/// If false, inlay hints are completely disabled.
bool enabled = true;
// Whether specific categories of hints are enabled.
bool parameters = true;
bool deduced_types = true;
bool designators = true;
bool block_end = false;
bool default_arguments = false;
// Limit the length of type names in inlay hints. (0 means no limit)
uint32_t type_name_limit = 32;
};
} // namespace clice::config
namespace clice::feature {
struct InlayHintKind : refl::Enum<InlayHintKind, false, std::uint8_t> {
enum Kind {
Params,
InvalidEnum,
};
using Enum::Enum;
enum class InlayHintKind {
Parameter,
InvalidEnum,
DefaultArgument,
Type,
Designator,
BlockEnd,
};
struct InlayHint {
/// The position offset of the inlay hint in the source code.
uint32_t offset;
std::uint32_t offset;
/// The kind/category of the inlay hint.
InlayHintKind kind;
@@ -33,8 +52,6 @@ struct InlayHint {
using InlayHints = std::vector<InlayHint>;
InlayHints inlayHints(CompilationUnit& unit, LocalSourceRange target);
index::Shared<InlayHints> indexInlayHint(CompilationUnit& unit);
InlayHints inlay_hints(CompilationUnit& unit, LocalSourceRange target);
} // namespace clice::feature