MCPcopy Create free account
hub / github.com/clice-io/clice / this_expr_hover

Function this_expr_hover

src/feature/hover.cpp:770–788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

768 if(auto info = try_directive(has_embed.loc, unit.file_path(*has_embed.file))) {
769 return info;
770 }
771 }
772 }
773 return std::nullopt;
774}
775
776/// A macro name at the cursor, rendered from the preprocessor record —
777/// macro semantics never reach the AST. The card shows the `#define` text,
778/// plus a preview of the expanded tokens at expansion sites.
779auto macro_hover(CompilationUnitRef unit, std::uint32_t offset) -> std::optional<HoverInfo> {
780 auto directives_it = unit.directives().find(unit.main_file());
781 if(directives_it == unit.directives().end()) {
782 return std::nullopt;
783 }
784
785 for(const auto& macro: directives_it->second.macros) {
786 /// A reference inside another expansion has no written token here.
787 if(macro.loc.isMacroID()) {
788 continue;
789 }
790 auto [fid, range] = unit.decompose_range(macro.loc);
791 if(offset < range.begin || offset >= range.end) {

Callers 1

expr_hoverFunction · 0.85

Calls 3

declared_typeFunction · 0.85
type_as_definitionFunction · 0.85
print_typeFunction · 0.85

Tested by

no test coverage detected