Skip to content

Conversation

@arnestrickmann
Copy link
Contributor

@arnestrickmann arnestrickmann commented Jan 9, 2026

Summary

Adds a built-in file viewer and code editor to Emdash, allowing users to browse project files and view code changes directly within the app without switching to external editors.

Features

  • File Explorer: Navigate project structure with tree view
  • Code Editor: Syntax-highlighted code viewing with Monaco editor
  • Git Diff Markers: Visual indicators in gutter showing added/modified/removed lines
  • File Search: Search within project files
  • Multi-tab Support: Open multiple files in tabs
  • Theme Support: Consistent dark/light themes across editor

Changes

  • Added EditorMode component for file viewing interface
  • Implemented FileTree component for project navigation
  • Integrated Monaco editor with syntax highlighting
  • Added git diff decorations with gutter markers
  • Created file icons system for visual file type recognition
  • Implemented content search functionality
  • Added tab management for multiple open files

Next

  • cmd+p in file search
  • auto-complete
  • Navigate through tabs with cmd+p
  • Close tabs with cmd+w
  • Switch through tabs with ctrl+rightarrow
  • Polish -> This is v1 of the feature

Testing

  • File tree navigation works correctly
  • Code syntax highlighting displays properly
  • Git diff markers appear for changed files
  • Search functionality returns accurate results
  • Tabs can be opened, switched, and closed
  • Theme switching maintains consistency

Demo
https://github.com/user-attachments/assets/6f132833-1f4c-4a94-a509-76f6a721427b

Interface
Screenshot 2026-01-09 at 14 46 51

Diff Markers
Screenshot 2026-01-09 at 14 47 52

Implements a fast, scalable content search feature for the file explorer with clean architecture and optimized performance.

## Features Added:
- Content search across all text files in the project
- Real-time search with debouncing (400ms)
- Search results with line numbers and preview context
- Support for case-sensitive/insensitive search
- Binary file detection and skipping
- Configurable result limits

## Architecture Improvements:
- Extracted search logic into reusable useContentSearch hook
- Created modular components (SearchInput, ContentSearchResults)
- Separated concerns following Single Responsibility Principle
- Implemented clean code patterns throughout

## Performance Optimizations:
- Async file processing with parallel batches (10 files concurrently)
- Binary file detection (extension check + byte analysis)
- File size limits (2MB max per file)
- Smart directory skipping (node_modules, .git, etc.)
- Early termination when query not found in file
- Limited to 5000 files and 100 results for UI performance

## Technical Details:
- Added IPC handler 'fs:searchContent' in fsIpc.ts
- TypeScript types fully defined in electron-api.d.ts
- Minimum 2 character search query requirement
- Blacklist approach for file filtering (more inclusive)
- Supports files without extensions (LICENSE, README, etc.)

## Clean Code Principles Applied:
- Small, focused functions (avg 10-15 lines)
- Descriptive naming throughout
- No magic numbers (all extracted to constants)
- Proper error handling with user-friendly messages
- Modular, testable, and maintainable code

Files modified:
- src/main/services/fsIpc.ts - Added search IPC handler
- src/main/preload.ts - Exposed fsSearchContent to renderer
- src/renderer/types/electron-api.d.ts - Added TypeScript types
- src/renderer/components/FileExplorer/FileTree.tsx - Integrated search UI
- src/renderer/components/FileExplorer/SearchInput.tsx - Search input component
- src/renderer/components/FileExplorer/ContentSearchResults.tsx - Results display
- src/renderer/hooks/useContentSearch.ts - Reusable search logic hook

The implementation follows professional software engineering practices and is production-ready.
Fixes red underlines in TypeScript code by configuring Monaco with proper compiler options.

## Changes:
- Added Monaco TypeScript configuration matching project tsconfig.json
- Set up path alias resolution (@/, @shared/, #types)
- Configured diagnostics to ignore irrelevant module resolution errors
- Added intellisense and autocomplete settings
- Implemented both TypeScript and JavaScript language defaults

## Technical Details:
- Compiler target: ES2020 with DOM libraries
- Module resolution: Node.js style with ESNext modules
- JSX support: React JSX transform
- Path mappings for project-specific imports
- Diagnostic codes ignored: 2307, 2792, 2304, 1149

This eliminates false positive errors in the editor while maintaining proper type checking for actual issues.
@vercel
Copy link

vercel bot commented Jan 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
docs Ready Ready Preview, Comment Jan 9, 2026 11:50pm

@arnestrickmann arnestrickmann merged commit 2c077ef into main Jan 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants