Add comprehensive features: snippets, export/import, tab renaming, session persistence, and enhanced auto-suggestions
- Snippets: Start empty, add via right-click context menu on selected text - Export/Import: Save and load snippets as JSON files with merge/replace options - Tab Renaming: Double-click tabs to rename them - Session Persistence: Tabs and their names are saved and restored on app restart - Delete Snippets: Remove unwanted snippets from the panel - Auto-suggestions: Comprehensive command database with 400+ commands - Includes Git, Docker, Kubernetes, NPM, Python, Ruby, Rust, Go, and more - Suggestions from command history, common commands, and system PATH - Updates in real-time as you type - Press Tab to accept suggestions - Fixed tab content persistence when switching between tabs - Fixed tab bar layout and positioning - All features fully functional and tested
This commit is contained in:
@@ -52,6 +52,28 @@ class SnippetManager {
|
||||
return snippets
|
||||
}
|
||||
|
||||
func exportSnippets() -> Data? {
|
||||
return try? JSONEncoder().encode(snippets)
|
||||
}
|
||||
|
||||
func importSnippets(from data: Data, replace: Bool = false) -> Bool {
|
||||
guard let imported = try? JSONDecoder().decode([Snippet].self, from: data) else {
|
||||
return false
|
||||
}
|
||||
|
||||
if replace {
|
||||
snippets = imported
|
||||
} else {
|
||||
// Merge, avoiding duplicates by command
|
||||
let existingCommands = Set(snippets.map { $0.command })
|
||||
let newSnippets = imported.filter { !existingCommands.contains($0.command) }
|
||||
snippets.append(contentsOf: newSnippets)
|
||||
}
|
||||
|
||||
saveSnippets()
|
||||
return true
|
||||
}
|
||||
|
||||
private func addDefaultSnippets() {
|
||||
// Removed - snippets now start empty
|
||||
// Users can add snippets via right-click context menu
|
||||
|
||||
Reference in New Issue
Block a user