scalps context prints the exact written source for one indexed definition. An attached documentation comment is included when Clang associated it with the definition. Optional neighbors are whole indexed definitions in the same file, not arbitrary line windows.
scalps context "Scintilla::Internal::Editor::SetWrapMode"
scalps context --before 1 --after 1 "Scintilla::Internal::Editor::SetWrapMode"The default index is .scalps/index.sqlite, the default project root is the working directory, and both neighbor counts default to zero. Use explicit locations when working outside those defaults:
scalps context --index /tmp/scalpel-editor.sqlite --project-root ../scalpel-editor "Scintilla::Internal::Editor::SetWrapMode"Quotes around the qualified name prevents a bash error when it contains (anonymous namespace).
Context lookup is an exact, case-sensitive qualified-name lookup. It does not run search ranking. When overloads or multiple written sites have the same qualified name, the command lists every matching project-relative file and starting line and exits with status 2.
Select one match with --file, --line, or both:
scalps context --file src/Editor.cxx --line 240 "fixture::convert"The file selector is project-relative. The line selector is the definition’s one-based starting line shown by scalps search or the ambiguity diagnostic.
Each block starts with previous, target, or next, followed by the qualified name, definition kind, project-relative file, and inclusive display lines. The source follows on the next line. Neighbor blocks use source order and never cross a file boundary.
target: fixture::Editor::SetWrapMode method src/Editor.cxx:47-49
/// Set the line wrapping mode.
void Editor::SetWrapMode(int mode) {
wrap_mode_ = mode;
}
Only attached documentation comments are included. Ordinary nearby comments that Clang did not attach remain outside the context block.
The index stores project-relative source ranges and content hashes, not a copy of every source file. Before printing anything, scalps context resolves the source beneath --project-root, reads it, and verifies the exact bytes against the index manifest. A missing, unreadable, moved, or changed source file causes exit status 2 and no standard output. Run scalps index and retry after source changes.
scalps context returns 0 after printing one complete context and 2 for argument errors, missing or incompatible indexes, an active index refresh, absent or ambiguous definitions, unsafe paths, stale source, invalid stored ranges, and read failures. Diagnostics use standard error.