ISymbolExtractionService Pennington.Roslyn.Symbols
Extracts symbol metadata and source fragments from the configured Roslyn Solution, keyed by xmldocid.
Methods
ClearCache
#void ClearCache();Clears any cached symbol lookups so the next query re-walks the solution.
ExtractCodeFragmentAsync
#Task<string> ExtractCodeFragmentAsync(string xmlDocId, bool bodyOnly = false, bool includeLeadingTrivia = true);Returns the source-code fragment for the symbol identified by xmlDocId, optionally limited to the member body and optionally including leading trivia (comments/attributes).
Parameters
xmlDocIdstringbodyOnlybool (optional)includeLeadingTriviabool (optional)
Returns
Task<string>ExtractDeclarationSignatureAsync
#Task<string> ExtractDeclarationSignatureAsync(string xmlDocId);Returns the declaration signature (no body, no accessor list) for the member identified by xmlDocId. Falls back to the full declaration for symbols that have no separable body.
Parameters
xmlDocIdstring
Returns
Task<string>ExtractSymbolsAsync
#Task<IReadOnlyDictionary<string, SymbolInfo>> ExtractSymbolsAsync(Solution solution);Walks the solution and returns a map of xmldocid to SymbolInfo for every documented symbol.
Parameters
solutionSolution
Returns
Task<IReadOnlyDictionary<string, SymbolInfo>>FindSymbolAsync
#Task<SymbolInfo?> FindSymbolAsync(string xmlDocId);Returns the SymbolInfo for the given xmldocid, or null if no symbol matches.
Parameters
xmlDocIdstring
Returns
Task<SymbolInfo?>WarmupAsync
#Task WarmupAsync(CancellationToken cancellationToken = default);Triggers the symbol table walk if it has not already run. Safe to call concurrently with real queries — both share one AsyncLazy task.
Parameters
cancellationTokenCancellationToken (optional)
Returns
TaskPennington.Roslyn.Symbols.ISymbolExtractionService
namespace Pennington.Roslyn.Symbols;
/// Extracts symbol metadata and source fragments from the configured Roslyn Solution, keyed by xmldocid.
public interface ISymbolExtractionService
{
/// Clears any cached symbol lookups so the next query re-walks the solution.
void ClearCache();
/// Returns the source-code fragment for the symbol identified by xmlDocId, optionally limited to the member body and optionally including leading trivia (comments/attributes).
Task<string> ExtractCodeFragmentAsync(string xmlDocId, bool bodyOnly = false, bool includeLeadingTrivia = true);
/// Returns the declaration signature (no body, no accessor list) for the member identified by xmlDocId. Falls back to the full declaration for symbols that have no separable body.
Task<string> ExtractDeclarationSignatureAsync(string xmlDocId);
/// Walks the solution and returns a map of xmldocid to SymbolInfo for every documented symbol.
Task<IReadOnlyDictionary<string, SymbolInfo>> ExtractSymbolsAsync(Solution solution);
/// Returns the SymbolInfo for the given xmldocid, or null if no symbol matches.
Task<SymbolInfo?> FindSymbolAsync(string xmlDocId);
/// Triggers the symbol table walk if it has not already run. Safe to call concurrently with real queries — both share one AsyncLazy task.
Task WarmupAsync(CancellationToken cancellationToken = default);
}