zoobzio January 18, 2026 Edit this page

Types Reference

Chunk

A semantic unit of code or documentation.

type Chunk struct {
    Content   string
    Symbol    string
    Kind      Kind
    StartLine int
    EndLine   int
    Context   []string
}
FieldTypeDescription
ContentstringThe actual source code or text, including comments
SymbolstringName of the function, class, type, or section
KindKindCategory of this chunk (function, method, class, etc.)
StartLineint1-indexed starting line number
EndLineint1-indexed ending line number
Context[]stringParent chain, e.g. ["class UserService"]

Notes:

  • Content includes documentation comments attached to the construct
  • Symbol for methods may include receiver: "User.Validate"
  • Context is empty for top-level constructs
  • Line numbers are 1-indexed (first line is 1, not 0)

Kind

Categorizes what a chunk represents.

type Kind string

const (
    KindFunction  Kind = "function"
    KindMethod    Kind = "method"
    KindClass     Kind = "class"
    KindInterface Kind = "interface"
    KindType      Kind = "type"
    KindEnum      Kind = "enum"
    KindConstant  Kind = "constant"
    KindVariable  Kind = "variable"
    KindSection   Kind = "section"
    KindModule    Kind = "module"
)
ConstantValueDescription
KindFunction"function"Standalone function
KindMethod"method"Function with receiver/self
KindClass"class"Class, struct, or impl block
KindInterface"interface"Interface, trait, or protocol
KindType"type"Type alias or other type definition
KindEnum"enum"Enumeration
KindConstant"constant"Constant declaration
KindVariable"variable"Variable declaration
KindSection"section"Markdown header/section
KindModule"module"Package or file-level construct

Language mappings:

LanguageConstructKind
Gofuncfunction
Gofunc (r *T)method
Gotype T structclass
Gotype T interfaceinterface
Gotype T = Utype
TypeScriptfunctionfunction
TypeScriptclass methodmethod
TypeScriptclassclass
TypeScriptinterfaceinterface
TypeScripttypetype
Pythondef (top-level)function
Pythondef (in class)method
Pythonclassclass
Rustfn (top-level)function
Rustfn (in impl)method
Ruststructtype
Rustimplclass
Rusttraitinterface
Rustenumenum
Markdown# headersection

Language

Identifies a programming language.

type Language string

const (
    Go         Language = "go"
    TypeScript Language = "typescript"
    JavaScript Language = "javascript"
    Python     Language = "python"
    Rust       Language = "rust"
    Markdown   Language = "markdown"
)
ConstantValueProvider Package
Go"go"chisel/golang
TypeScript"typescript"chisel/typescript
JavaScript"javascript"chisel/typescript
Python"python"chisel/python
Rust"rust"chisel/rust
Markdown"markdown"chisel/markdown

Notes:

  • TypeScript and JavaScript use the same provider package
  • Use typescript.NewJavaScript() for JavaScript files

Provider

Interface for language-specific parsers.

type Provider interface {
    Chunk(ctx context.Context, filename string, content []byte) ([]Chunk, error)
    Language() Language
}
MethodDescription
ChunkParses content and returns semantic chunks
LanguageReturns the language this provider handles

Implementing a custom provider:

type MyProvider struct{}

func (p *MyProvider) Chunk(ctx context.Context, filename string, content []byte) ([]chisel.Chunk, error) {
    // Parse content and extract chunks
    return chunks, nil
}

func (p *MyProvider) Language() chisel.Language {
    return "mylang"
}

Chunker

Routes chunking requests to appropriate providers.

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

Created with chisel.New(). See API Reference for methods.