Skip to main content

macro_across_files

Function macro_across_files 

Source
pub fn macro_across_files(
    index: &ProjectIndex,
    root: &CppSyntaxNode,
    path: &Path,
    offset: usize,
) -> Known<ProjectMacro>
Expand description

Where the macro name written at offset is defined — or that it is not a macro there.

The entry point for “go to definition” on a macro, and the counterpart of definition_across_files. It needs no scope tree and no second layer, because a macro query is not a name lookup at all: it is a question about translation order — which of the #defines and #undefs written before this point is the last one — and the index already stores every one of them with the offset it was written at.

UnknownReason::UnparsableName when the offset is not on a name at all, which is the ordinary answer for most cursor positions.