You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Copilot Instructions for Magento Log Viewer Extension
2
2
3
+
## Core Principles
4
+
5
+
**Maintainability is the highest priority.** Always prefer clean, well-structured code over quick solutions.
6
+
7
+
**Performance is a feature** - treat it as such in every implementation decision. Every change must consider impact on user experience.
8
+
3
9
## Architecture Overview
4
10
5
11
This is a VS Code extension that provides intelligent viewing and management of Magento log files. The extension follows a modular architecture with clear separation of concerns:
-**File I/O Optimization**: Cache file reads, use streaming for large files, batch file operations
41
+
-**Background Processing**: Move intensive work to background threads when possible
42
+
43
+
## Code Organization & Maintainability Best Practices
44
+
45
+
-**Split large functions** - Break complex logic into smaller, testable functions (max 20-30 lines)
46
+
-**Create separate files** - When modules exceed 400-500 lines, split into focused files (e.g., `cacheManager.ts`, `cleanupService.ts`)
47
+
-**Single responsibility** - Each function/class should have one clear purpose
48
+
-**Clear naming** - Use descriptive names that explain intent without comments
49
+
-**Testable units** - Write code that can be easily unit tested in isolation
50
+
-**Consistent patterns** - Follow established patterns in the codebase
51
+
-**Type safety** - Use TypeScript strictly, avoid `any` types
52
+
-**Immutable data** - Prefer immutable operations where possible
53
+
54
+
**Better to have more files with clear responsibilities than fewer files with mixed concerns.**
55
+
27
56
## Key Architectural Patterns
28
57
29
58
### Workspace-Scoped Configuration
30
59
The extension uses workspace-scoped settings via `vscode.workspace.getConfiguration('magentoLogViewer', workspaceUri)`. All configuration is stored per-workspace, allowing different Magento projects to have independent settings.
31
60
32
61
### Asynchronous Initialization
33
62
```typescript
34
-
//Pattern: Delay heavy operations to let VS Code indexing settle
63
+
//Best Practice: Delay heavy operations to let VS Code indexing settle
- Use descriptive test names that explain the expected behavior
156
+
- Mock external dependencies (file system, VS Code API)
157
+
- Test edge cases and error conditions
158
+
- Run tests with `npm run test` or F5 debug launch
138
159
139
160
## Release Documentation
140
161
@@ -146,3 +167,30 @@ After implementing new features or fixes, update [CHANGELOG.md](../CHANGELOG.md)
146
167
- Example: "Added automatic cleanup of old log files" instead of "Implemented autoCleanupOldLogFiles() function"
147
168
148
169
When modifying this extension, prioritize user experience with immediate feedback, maintain the caching system integrity, and ensure proper disposal of resources to prevent memory leaks.
170
+
171
+
## Code Organization & Maintainability Best Practices
172
+
173
+
**Maintainability is the highest priority.** Always prefer clean, well-structured code over quick solutions:
174
+
175
+
-**Split large functions** - Break complex logic into smaller, testable functions (max 20-30 lines)
176
+
-**Create separate files** - When modules exceed 400-500 lines, split into focused files (e.g., `cacheManager.ts`, `cleanupService.ts`)
177
+
-**Single responsibility** - Each function/class should have one clear purpose
178
+
-**Clear naming** - Use descriptive names that explain intent without comments
179
+
-**Testable units** - Write code that can be easily unit tested in isolation
180
+
-**Consistent patterns** - Follow established patterns in the codebase
181
+
-**Type safety** - Use TypeScript strictly, avoid `any` types
182
+
-**Immutable data** - Prefer immutable operations where possible
183
+
184
+
**Better to have more files with clear responsibilities than fewer files with mixed concerns.**
185
+
186
+
## Critical Performance Guidelines
187
+
188
+
**Always prioritize end-user performance.** Every change must consider impact on user experience:
189
+
190
+
-**Startup Performance**: Never block VS Code startup - defer heavy operations until needed
0 commit comments