Documentation
¶
Overview ¶
Package srcview provides trusted-byte source inspection and safe project file reads.
Plane: shared
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoStructure = errors.New("file does not have a symbol tree")
ErrNoStructure reports a supported read with no targetable symbol structure.
Functions ¶
func IsMarkdown ¶
IsMarkdown reports whether filename uses Markdown section structure.
Types ¶
type Inspector ¶
type Inspector struct {
// contains filtered or unexported fields
}
Inspector reads structure from caller-trusted filename and source bytes.
func NewInspector ¶
NewInspector returns an inspector over trusted in-memory source.
func (*Inspector) Read ¶
func (i *Inspector) Read(symbolID string, limit int) (ReadResult, error)
Read reads a targetable symbol or section, including an attached code doc comment.
func (*Inspector) ReadContent ¶
ReadContent preserves the established CLI representation of a full symbol or section.
func (*Inspector) RenderTree ¶
RenderTree renders the inspector outline in the existing CLI format.
type Outline ¶
type Outline struct {
Language string `json:"language"`
Title string `json:"title,omitempty"`
Symbols []Symbol `json:"symbols"`
}
Outline is the typed structure of one source file.
type ProjectService ¶
type ProjectService struct {
// contains filtered or unexported fields
}
ProjectService resolves project aliases and safely reads repository-relative files.
func NewProjectService ¶
func NewProjectService(projects projectGetter) *ProjectService
NewProjectService creates a project-backed source read service.
type ReadResult ¶
ReadResult is a bounded symbol read with byte offsets into the file.
type Symbol ¶
type Symbol struct {
ID string `json:"id"`
Targetable bool `json:"targetable"`
Name string `json:"name"`
Kind string `json:"kind"`
Parent string `json:"parent"`
Level int `json:"level"`
StartByte int `json:"start_byte"`
EndByte int `json:"end_byte"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
HasDoc bool `json:"has_doc"`
// contains filtered or unexported fields
}
Symbol is one source declaration or Markdown section in an outline.