Documentation
¶
Index ¶
- func CompareDiffs(diff1, diff2 []diffmatchpatch.Diff) string
- func ShowDiffPreview(original, modified string, maxLines int) string
- type DiffKeyMap
- type DiffMode
- type DiffStyles
- type DiffView
- func (dv *DiffView) GetAction() DiffViewAction
- func (dv *DiffView) Init() tea.Cmd
- func (dv *DiffView) IsApproved() bool
- func (dv *DiffView) Resize(width, height int)
- func (dv *DiffView) SetContent(original, modified, filePath string)
- func (dv *DiffView) SetDiff(diffBlocks []edit.DiffFormat, filePath string)
- func (dv *DiffView) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (dv *DiffView) View() string
- type DiffViewAction
- type DiffViewConfig
- type DiffViewResult
- type EditorAction
- type EditorKeyMap
- type EditorMode
- type EditorStyles
- type EditorView
- func (ev *EditorView) GetAction() EditorAction
- func (ev *EditorView) GetContent() string
- func (ev *EditorView) Init() tea.Cmd
- func (ev *EditorView) IsModified() bool
- func (ev *EditorView) IsSaved() bool
- func (ev *EditorView) LoadFile(filePath string) error
- func (ev *EditorView) Resize(width, height int)
- func (ev *EditorView) SaveFile() error
- func (ev *EditorView) SetContent(content string)
- func (ev *EditorView) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (ev *EditorView) View() string
- type EditorViewConfig
- type EditorViewResult
- type FileItem
- type FileListItem
- type FileView
- func (fv *FileView) GetAction() FileViewAction
- func (fv *FileView) GetSelectedFile() *FileItem
- func (fv *FileView) Init() tea.Cmd
- func (fv *FileView) LoadDirectory(path string) error
- func (fv *FileView) Resize(width, height int)
- func (fv *FileView) Search(query string)
- func (fv *FileView) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (fv *FileView) View() string
- type FileViewAction
- type FileViewConfig
- type FileViewKeyMap
- type FileViewMode
- type FileViewResult
- type FileViewStyles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareDiffs ¶
func CompareDiffs(diff1, diff2 []diffmatchpatch.Diff) string
CompareDiffs compares two diff results and highlights differences
func ShowDiffPreview ¶
ShowDiffPreview shows a quick diff preview without interaction
Types ¶
type DiffKeyMap ¶
type DiffKeyMap struct {
Approve key.Binding
Reject key.Binding
Edit key.Binding
Save key.Binding
Cancel key.Binding
Up key.Binding
Down key.Binding
PageUp key.Binding
PageDown key.Binding
Home key.Binding
End key.Binding
Help key.Binding
Quit key.Binding
}
DiffKeyMap defines keyboard shortcuts for diff view
type DiffStyles ¶
type DiffStyles struct {
Base lipgloss.Style
Header lipgloss.Style
LineNumber lipgloss.Style
Added lipgloss.Style
Removed lipgloss.Style
Modified lipgloss.Style
Context lipgloss.Style
Highlight lipgloss.Style
Error lipgloss.Style
Success lipgloss.Style
}
DiffStyles defines styling for diff view components
type DiffView ¶
type DiffView struct {
// contains filtered or unexported fields
}
DiffView represents a visual diff display component
func NewDiffView ¶
func NewDiffView(config DiffViewConfig) *DiffView
NewDiffView creates a new diff view instance
func (*DiffView) GetAction ¶
func (dv *DiffView) GetAction() DiffViewAction
GetAction returns the last user action
func (*DiffView) IsApproved ¶
IsApproved returns whether the diff was approved
func (*DiffView) SetContent ¶
SetContent sets the original and modified content for diff
func (*DiffView) SetDiff ¶
func (dv *DiffView) SetDiff(diffBlocks []edit.DiffFormat, filePath string)
SetDiff sets the diff content directly from edit operations
type DiffViewAction ¶
type DiffViewAction string
DiffViewAction represents user actions in the diff view
const ( ActionApprove DiffViewAction = "approve" ActionReject DiffViewAction = "reject" ActionEdit DiffViewAction = "edit" ActionSave DiffViewAction = "save" ActionCancel DiffViewAction = "cancel" )
type DiffViewConfig ¶
type DiffViewConfig struct {
Mode DiffMode `json:"mode"`
ShowLineNumbers bool `json:"show_line_numbers"`
TabSize int `json:"tab_size"`
ContextLines int `json:"context_lines"`
EnableSyntax bool `json:"enable_syntax"`
AutoApprove bool `json:"auto_approve"`
Theme string `json:"theme"`
}
DiffViewConfig configures the diff view behavior
type DiffViewResult ¶
type DiffViewResult struct {
Action DiffViewAction `json:"action"`
Approved bool `json:"approved"`
FilePath string `json:"file_path"`
Duration time.Duration `json:"duration"`
Error string `json:"error,omitempty"`
}
DiffViewResult represents the result of a diff view session
func RunDiffView ¶
func RunDiffView(original, modified, filePath string, config DiffViewConfig) (*DiffViewResult, error)
RunDiffView runs an interactive diff view session
type EditorAction ¶
type EditorAction string
EditorAction represents user actions in the editor
const ( EditorActionSave EditorAction = "save" EditorActionCancel EditorAction = "cancel" EditorActionPreview EditorAction = "preview" EditorActionFormat EditorAction = "format" EditorActionUndo EditorAction = "undo" EditorActionRedo EditorAction = "redo" EditorActionFind EditorAction = "find" EditorActionReplace EditorAction = "replace" EditorActionQuit EditorAction = "quit" )
type EditorKeyMap ¶
type EditorKeyMap struct {
Save key.Binding
Cancel key.Binding
Preview key.Binding
Format key.Binding
Undo key.Binding
Redo key.Binding
Find key.Binding
Replace key.Binding
SwitchMode key.Binding
ToggleWrap key.Binding
LineNumbers key.Binding
Quit key.Binding
}
EditorKeyMap defines keyboard shortcuts for the editor
type EditorMode ¶
type EditorMode string
EditorMode represents different editor modes
const ( EditorModeEdit EditorMode = "edit" EditorModePreview EditorMode = "preview" EditorModeSplit EditorMode = "split" EditorModeDiff EditorMode = "diff" )
type EditorStyles ¶
type EditorStyles struct {
Base lipgloss.Style
Header lipgloss.Style
Editor lipgloss.Style
Preview lipgloss.Style
LineNumber lipgloss.Style
Cursor lipgloss.Style
Selection lipgloss.Style
Status lipgloss.Style
Error lipgloss.Style
Success lipgloss.Style
Modified lipgloss.Style
Border lipgloss.Style
}
EditorStyles defines styling for editor components
type EditorView ¶
type EditorView struct {
// contains filtered or unexported fields
}
EditorView represents an interactive code editor component
func NewEditorView ¶
func NewEditorView(config EditorViewConfig, fileEditor *edit.FileEditor, parser *treesitter.TreeSitterParser) *EditorView
NewEditorView creates a new editor instance
func (*EditorView) GetAction ¶
func (ev *EditorView) GetAction() EditorAction
GetAction returns the last user action
func (*EditorView) GetContent ¶
func (ev *EditorView) GetContent() string
GetContent returns the current editor content
func (*EditorView) Init ¶
func (ev *EditorView) Init() tea.Cmd
Resize updates the editor dimensions Init initializes the editor view model
func (*EditorView) IsModified ¶
func (ev *EditorView) IsModified() bool
IsModified returns whether the content has been modified
func (*EditorView) IsSaved ¶
func (ev *EditorView) IsSaved() bool
IsSaved returns whether the content has been saved
func (*EditorView) LoadFile ¶
func (ev *EditorView) LoadFile(filePath string) error
LoadFile loads content from a file
func (*EditorView) Resize ¶
func (ev *EditorView) Resize(width, height int)
func (*EditorView) SaveFile ¶
func (ev *EditorView) SaveFile() error
SaveFile saves the current content to file
func (*EditorView) SetContent ¶
func (ev *EditorView) SetContent(content string)
SetContent sets the editor content directly
type EditorViewConfig ¶
type EditorViewConfig struct {
FilePath string `json:"file_path"`
Language treesitter.Language `json:"language"`
Mode EditorMode `json:"mode"`
ShowLineNumbers bool `json:"show_line_numbers"`
TabSize int `json:"tab_size"`
WordWrap bool `json:"word_wrap"`
AutoSave bool `json:"auto_save"`
AutoFormat bool `json:"auto_format"`
SyntaxHighlight bool `json:"syntax_highlight"`
LivePreview bool `json:"live_preview"`
VimMode bool `json:"vim_mode"`
Theme string `json:"theme"`
MaxFileSize int64 `json:"max_file_size"`
}
EditorViewConfig configures the editor behavior
type EditorViewResult ¶
type EditorViewResult struct {
Action EditorAction `json:"action"`
Content string `json:"content,omitempty"`
FilePath string `json:"file_path"`
Saved bool `json:"saved"`
Modified bool `json:"modified"`
Duration time.Duration `json:"duration"`
Error string `json:"error,omitempty"`
}
EditorViewResult represents the result of an editor session
func RunEditorView ¶
func RunEditorView(config EditorViewConfig, fileEditor *edit.FileEditor, parser *treesitter.TreeSitterParser) (*EditorViewResult, error)
RunEditorView runs an interactive editor session
type FileItem ¶
type FileItem struct {
Name string `json:"name"`
Path string `json:"path"`
RelativePath string `json:"relative_path"`
IsDir bool `json:"is_dir"`
Size int64 `json:"size"`
ModTime time.Time `json:"mod_time"`
GitStatus string `json:"git_status,omitempty"`
Language treesitter.Language `json:"language,omitempty"`
Preview string `json:"preview,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
FileItem represents a file or directory in the browser
type FileListItem ¶
type FileListItem struct {
// contains filtered or unexported fields
}
FileListItem implements list.Item for the file list
func (FileListItem) Description ¶
func (i FileListItem) Description() string
func (FileListItem) FilterValue ¶
func (i FileListItem) FilterValue() string
func (FileListItem) Title ¶
func (i FileListItem) Title() string
type FileView ¶
type FileView struct {
// contains filtered or unexported fields
}
FileView represents an interactive file browser component
func NewFileView ¶
func NewFileView(config FileViewConfig, discovery *appcontext.FileDiscovery, parser *treesitter.TreeSitterParser) *FileView
NewFileView creates a new file browser instance
func (*FileView) GetAction ¶
func (fv *FileView) GetAction() FileViewAction
GetAction returns the last user action
func (*FileView) GetSelectedFile ¶
GetSelectedFile returns the currently selected file
func (*FileView) LoadDirectory ¶
LoadDirectory loads files from the specified directory
type FileViewAction ¶
type FileViewAction string
FileViewAction represents user actions in the file view
const ( FileActionSelect FileViewAction = "select" FileActionEdit FileViewAction = "edit" FileActionPreview FileViewAction = "preview" FileActionSearch FileViewAction = "search" FileActionRefresh FileViewAction = "refresh" FileActionBack FileViewAction = "back" FileActionQuit FileViewAction = "quit" )
type FileViewConfig ¶
type FileViewConfig struct {
RootPath string `json:"root_path"`
Mode FileViewMode `json:"mode"`
ShowHidden bool `json:"show_hidden"`
ShowGitStatus bool `json:"show_git_status"`
EnablePreview bool `json:"enable_preview"`
MaxPreviewLines int `json:"max_preview_lines"`
FuzzySearch bool `json:"fuzzy_search"`
PreviewSyntax bool `json:"preview_syntax"`
TreeIndent int `json:"tree_indent"`
Extensions []string `json:"extensions,omitempty"`
ExcludePatterns []string `json:"exclude_patterns,omitempty"`
}
FileViewConfig configures the file browser behavior
type FileViewKeyMap ¶
type FileViewKeyMap struct {
Select key.Binding
Edit key.Binding
Preview key.Binding
Search key.Binding
Refresh key.Binding
Back key.Binding
Up key.Binding
Down key.Binding
Left key.Binding
Right key.Binding
PageUp key.Binding
PageDown key.Binding
Home key.Binding
End key.Binding
Enter key.Binding
Escape key.Binding
Tab key.Binding
Help key.Binding
Quit key.Binding
}
FileViewKeyMap defines keyboard shortcuts for file view
type FileViewMode ¶
type FileViewMode string
FileViewMode represents different file browser modes
const ( FileViewModeTree FileViewMode = "tree" FileViewModeList FileViewMode = "list" FileViewModeSearch FileViewMode = "search" FileViewModePreview FileViewMode = "preview" )
type FileViewResult ¶
type FileViewResult struct {
Action FileViewAction `json:"action"`
SelectedFile *FileItem `json:"selected_file,omitempty"`
CurrentPath string `json:"current_path"`
Duration time.Duration `json:"duration"`
Error string `json:"error,omitempty"`
}
FileViewResult represents the result of a file view session
func RunFileView ¶
func RunFileView(config FileViewConfig, discovery *appcontext.FileDiscovery, parser *treesitter.TreeSitterParser) (*FileViewResult, error)
RunFileView runs an interactive file browser session
type FileViewStyles ¶
type FileViewStyles struct {
Base lipgloss.Style
Header lipgloss.Style
List lipgloss.Style
Preview lipgloss.Style
Search lipgloss.Style
Directory lipgloss.Style
File lipgloss.Style
Selected lipgloss.Style
GitAdded lipgloss.Style
GitModified lipgloss.Style
GitDeleted lipgloss.Style
Error lipgloss.Style
Loading lipgloss.Style
Border lipgloss.Style
}
FileViewStyles defines styling for file view components