This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

ISourceFragmentService Pennington.TreeSitter.Fragments

Resolves a source file plus an optional member name path to its source text using tree-sitter.

Methods

GetFragment

#
public FragmentResult GetFragment(string languageId, string relativeFilePath, string namePath, FragmentOptions options)

Returns the source text of namePath within relativeFilePath, or a failure. An empty namePath returns the whole file. options select body-only extraction, an elided-body outline, and whether the file's imports are prepended.

Parameters

languageId string
relativeFilePath string
namePath string
options FragmentOptions

Returns

FragmentResult

Pennington.TreeSitter.Fragments.ISourceFragmentService

namespace Pennington.TreeSitter.Fragments;

/// Resolves a source file plus an optional member name path to its source text using tree-sitter.
public interface ISourceFragmentService
{
    /// Returns the source text of namePath within relativeFilePath, or a failure. An empty namePath returns the whole file. options select body-only extraction, an elided-body outline, and whether the file's imports are prepended.
    
public FragmentResult GetFragment(string languageId, string relativeFilePath, string namePath, FragmentOptions options)
; }