csharp

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package csharp provides a documentation source adapter that reads C# source code from a local clone of a .NET/ASP.NET/EF Core GitHub repository. It parses raw .cs source via tree-sitter to extract classes, interfaces, structs, records, enums, delegates, methods, properties, and XML doc comments without making any network calls during parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewABPFactory

func NewABPFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewABPFactory creates a Source for the ABP Framework.

func NewASPNetCoreFactory

func NewASPNetCoreFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewASPNetCoreFactory creates a Source for ASP.NET Core.

func NewAutoMapperFactory

func NewAutoMapperFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewAutoMapperFactory creates a Source for AutoMapper.

func NewAvaloniaFactory

func NewAvaloniaFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewAvaloniaFactory creates a Source for Avalonia UI.

func NewBlazorFactory

func NewBlazorFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewBlazorFactory creates a Source for Blazor.

func NewCarterFactory

func NewCarterFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewCarterFactory creates a Source for Carter.

func NewDapperFactory

func NewDapperFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewDapperFactory creates a Source for Dapper.

func NewDotNetBCLFactory

func NewDotNetBCLFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewDotNetBCLFactory creates a Source for the .NET Base Class Library.

func NewEFCoreFactory

func NewEFCoreFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewEFCoreFactory creates a Source for Entity Framework Core.

func NewFluentValidationFactory

func NewFluentValidationFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewFluentValidationFactory creates a Source for FluentValidation.

func NewMAUIFactory

func NewMAUIFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewMAUIFactory creates a Source for .NET MAUI.

func NewMassTransitFactory

func NewMassTransitFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewMassTransitFactory creates a Source for MassTransit.

func NewMediatRFactory

func NewMediatRFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewMediatRFactory creates a Source for MediatR.

func NewNUnitFactory

func NewNUnitFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewNUnitFactory creates a Source for NUnit.

func NewNewtonsoftJsonFactory

func NewNewtonsoftJsonFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewNewtonsoftJsonFactory creates a Source for Newtonsoft.Json.

func NewOrleansFactory

func NewOrleansFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewOrleansFactory creates a Source for Orleans.

func NewPollyFactory

func NewPollyFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewPollyFactory creates a Source for Polly.

func NewSerilogFactory

func NewSerilogFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewSerilogFactory creates a Source for Serilog.

func NewServiceStackFactory

func NewServiceStackFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewServiceStackFactory creates a Source for ServiceStack.

func NewWolverineFactory

func NewWolverineFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewWolverineFactory creates a Source for Wolverine.

func NewXUnitFactory

func NewXUnitFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewXUnitFactory creates a Source for xUnit.net.

Types

type CSharpSource

type CSharpSource struct {
	// contains filtered or unexported fields
}

CSharpSource is a documentation source adapter that reads C# source code from a local repository clone. It parses raw .cs source using tree-sitter to extract all public type declarations and their members.

func New

func New(repoPath string, cfg Config, opts ...Option) *CSharpSource

New constructs a new CSharpSource pointing at a local clone of a C# repo.

func (*CSharpSource) DetectWrapper

func (s *CSharpSource) DetectWrapper(method *source.Method) (bool, string, string)

DetectWrapper analyzes a method's source code for delegation patterns.

func (*CSharpSource) DiscoverEntities

func (s *CSharpSource) DiscoverEntities(ctx context.Context, fetch source.FetchFunc) ([]string, error)

DiscoverEntities walks the local repository and returns identifiers for all public type declarations. The fetch parameter is unused for local sources.

func (*CSharpSource) ID

func (s *CSharpSource) ID() string

ID returns the canonical library ID (e.g., "csharp/aspnetcore").

func (*CSharpSource) Meta

func (s *CSharpSource) Meta() source.LibraryMeta

Meta returns metadata for the library record.

func (*CSharpSource) ParseEntity

func (s *CSharpSource) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)

ParseEntity parses a single entity from file content, identified by entityID. The entityID has the form "filepath#Namespace.TypeName".

func (*CSharpSource) ParseMethod

func (s *CSharpSource) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)

ParseMethod parses a single method from file content. The methodID has the form "filepath#Namespace.TypeName.MethodName".

func (*CSharpSource) ParseSourceCode

func (s *CSharpSource) ParseSourceCode(entityID string, content []byte) (string, error)

ParseSourceCode extracts just the source code of a specific entity or method.

func (*CSharpSource) ResolveWrapperURL

func (s *CSharpSource) ResolveWrapperURL(targetName, targetKind, entitySlug string) string

ResolveWrapperURL constructs the identifier to fetch a wrapped target's source.

type Config

type Config struct {
	// LibraryID is the canonical library ID (e.g., "csharp/aspnetcore").
	LibraryID string

	// Name is the human-readable library name.
	Name string

	// Description is a brief description of the library.
	Description string

	// SourceURL is the canonical GitHub URL of the repository.
	SourceURL string

	// SourceDirs lists relative directories within the repo to scan.
	// If empty, the entire repo is scanned (excluding test/obj/bin dirs).
	SourceDirs []string
}

Config holds settings for a C# source adapter. It is configurable for any C# library (.NET runtime, ASP.NET Core, EF Core, etc.).

type Option

type Option func(*CSharpSource)

Option customises a CSharpSource at construction time.

func WithRef

func WithRef(ref string) Option

WithRef sets the git ref (tag or branch) for source-code links.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL