Skip to content

Commit 3dbb6c5

Browse files
authored
Feature/language tracking (#66)
* feat: Update version to 0.6.0 and enhance language detection - Updated package version to 0.6.0 in package.json. - Added 'language' field to TimeEntry and SummaryData interfaces in database.ts. - Implemented migration logic for existing entries to include 'language'. - Modified addEntry and searchEntries methods to handle 'language'. - Enhanced SummaryData to include language summary. - Updated SummaryViewProvider to display insights on languages used and projects worked. - Added utility functions for detecting programming language from file extensions and VS Code language IDs. - Integrated language detection into TimeTracker class. - Created a test script for verifying language detection functionality. * feat: update average daily time chart to horizontal bar format with detailed time period calculations * feat: enhance summary view with horizontal time bars and new analytics widgets * fix: update section title from 'Weekly & Monthly Analytics' to 'Coding Time Analytics' * style: enhance theme-specific styling for summary and analytics sections * feat: add development commands for generating and deleting test data
1 parent 3fbf436 commit 3dbb6c5

12 files changed

Lines changed: 2082 additions & 192 deletions

CONTRIBUTING.md

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@ The project is organized as follows:
1010
vscode-time-tracker/
1111
├── .vscode/ # VSCode-specific settings
1212
├── src/ # Source code
13-
│ ├── extension.ts # Main extension file
13+
│ ├── extension.ts # Main extension file (includes test data commands)
1414
│ ├── statusBar.ts # Status bar functionality
1515
│ ├── summaryView.ts # Summary view implementation
1616
│ ├── timeTracker.ts # Time tracking logic
1717
│ ├── database.ts # Database operations
18-
│ └── readme.md # Source code documentation
18+
│ ├── healthNotifications.ts # Health notification system
19+
│ ├── logger.ts # Logging utilities
20+
│ └── utils.ts # Utility functions
1921
├── .gitignore # Git ignore file
20-
├── package.json # Project metadata and dependencies
22+
├── package.json # Project metadata, dependencies, and test commands
2123
├── README.md # Project readme
2224
├── CONTRIBUTING.md # Contributing guidelines
25+
├── TECHNICAL.md # Technical documentation and testing guide
2326
└── LICENSE # License information
2427
```
2528

@@ -47,6 +50,53 @@ To compile the extension, run:
4750

4851
This will transpile the TypeScript files to JavaScript.
4952

53+
## Testing the Extension
54+
55+
### Development Mode Testing
56+
57+
For testing during development:
58+
59+
1. **Open the project in VS Code**
60+
2. **Press F5** to launch Extension Development Host
61+
3. **Test your changes** in the new VS Code window
62+
63+
### Package Testing
64+
65+
For testing packaged extensions:
66+
67+
1. **Enable test commands**:
68+
- Open Settings (`Ctrl+,`)
69+
- Search `"enableDevCommands"`
70+
- Enable "Simple Coding Time Tracker › Enable Dev Commands"
71+
72+
2. **Generate test data**:
73+
- Press `Ctrl+Shift+P`
74+
- Run `SCTT: Generate Test Data (Dev)`
75+
- This creates 90 days of realistic test data
76+
77+
3. **Test all features**:
78+
- Summary view and charts
79+
- Search and filtering
80+
- Status bar functionality
81+
- Theme compatibility
82+
83+
4. **Clean up**:
84+
- Run `SCTT: Delete Test Data (Dev)` to remove test data
85+
- Disable dev commands when done
86+
87+
### Testing Checklist
88+
89+
Before submitting a pull request, verify:
90+
91+
- ✅ Time tracking starts/stops correctly
92+
- ✅ Status bar updates in real-time
93+
- ✅ Charts render properly in light/dark themes
94+
- ✅ Search and filtering work correctly
95+
- ✅ Data persists across VS Code restarts
96+
- ✅ Health notifications function (if enabled)
97+
- ✅ Extension works with packaged installation
98+
- ✅ No console errors in Developer Tools
99+
50100
## Creating a VSCode Package
51101

52102
To package the extension for distribution:

README.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,25 @@ Simple Coding Time Tracker is a powerful extension for Visual Studio Code that h
1414

1515
- **Automatic Time Tracking**: Seamlessly tracks your coding time in the background.
1616
- **Project and Branch Tracking**: Organizes time data by project and Git branches for comprehensive analysis.
17+
- **Language Tracking**: Automatically detects and tracks time spent in different programming languages.
1718
- **Smart Activity Detection**: Automatically pauses tracking during periods of inactivity.
1819
- **Focused Work Detection**: Intelligently tracks time even when VS Code isn't focused.
1920
- **Health Notification System**: Proactive reminders to promote healthy coding habits with scientifically backed intervals.
2021
- **Interactive Data Visualization**:
2122
- Project Summary Chart: Visual breakdown of time spent on each project
2223
- Daily Activity Timeline: Interactive line chart showing your coding patterns
2324
- Activity Heatmap: 3-month calendar view showing coding intensity
25+
- Language Distribution Chart: Visual breakdown of time spent in different programming languages
2426
- Theme-Aware Charts: Automatically adapts to VS Code's light/dark themes
2527
- **Advanced Search & Filtering**:
2628
- Date Range Selection: Filter data by specific time periods
2729
- Project Filtering: Focus on specific projects
30+
- Language Filtering: Focus on specific programming languages
2831
- Quick Reset: One-click reset for search filters
2932
- **Data Persistence**: Safely stores your time data for long-term analysis.
3033

3134
## Time Tracking Details
32-
The extension tracks your coding time by monitoring file changes and user activity within Visual Studio Code. It uses a combination of timers and event listeners to ensure accurate tracking without impacting performance.
35+
The extension tracks your coding time by monitoring file changes and user activity within Visual Studio Code. It uses a combination of timers and event listeners to ensure accurate tracking without impacting performance. The extension automatically detects the programming language you're working with based on file extensions and VS Code's language detection.
3336

3437
**📖 For detailed configuration, advanced features, and complete documentation, see the [Time Tracking Guide](https://github.com/twentyTwo/vsc-ext-coding-time-tracker/wiki/Time-Tracking) in our wiki.**
3538

@@ -60,14 +63,15 @@ Once installed, the extension will automatically start tracking your coding time
6063

6164
1. In the summary view, locate the search form
6265
2. Select a date range using the date pickers
63-
3. Filter by project and/or branch:
66+
3. Filter by project, branch, and/or language:
6467
- Choose a specific project to see all its branches
6568
- Select a branch to see time data for that specific branch
69+
- Select a language to see time data for that specific programming language
6670
- The branch dropdown automatically updates to show only branches from the selected project
6771
4. Click "Search" to apply filters
6872
5. Use "Reset" to clear all filters and refresh the view
6973

70-
The charts and visualizations will automatically update to reflect your selected project and branch filters.
74+
The charts and visualizations will automatically update to reflect your selected project, branch, and language filters.
7175

7276
### Configuration Options
7377

@@ -99,6 +103,7 @@ The summary page provides a detailed report of your coding activity with interac
99103
- Project distribution chart showing time allocation across projects
100104
- Daily activity timeline with interactive tooltips
101105
- 3-month activity heatmap for long-term pattern analysis
106+
- Language distribution chart showing time spent in different programming languages
102107
- Theme-aware visualizations that adapt to your VS Code theme
103108
- Advanced search and filtering capabilities
104109

@@ -130,12 +135,45 @@ For comprehensive documentation, guides, and testing information, visit our **[D
130135
- **[Test Scenarios](https://github.com/twentyTwo/vsc-ext-coding-time-tracker/wiki/Test-Scenarios)** - Comprehensive testing documentation
131136
- **[Development Roadmap](https://github.com/twentyTwo/vsc-ext-coding-time-tracker/wiki/TODO)** - Current tasks and future plans
132137

138+
## Testing & Development
139+
140+
For developers and testers, the extension includes built-in test data generation commands:
141+
142+
### Enabling Test Commands
143+
1. Open Settings (`Ctrl+,`)
144+
2. Search: `"enableDevCommands"`
145+
3. Enable "Simple Coding Time Tracker › Enable Dev Commands"
146+
147+
### Available Test Commands
148+
- **`SCTT: Generate Test Data (Dev)`** - Creates realistic test data for 90 days
149+
- **`SCTT: Delete Test Data (Dev)`** - Safely removes all tracking data
150+
151+
**Note**: These commands are hidden from regular users and only appear when explicitly enabled in settings.
152+
153+
For complete testing documentation, see [TECHNICAL.md](TECHNICAL.md).
154+
133155
## Technical Documentation
134156

135157
For technical details about development, release process, and internal architecture, please see [TECHNICAL.md](TECHNICAL.md).
136158

137159
## Changelog
138160

161+
### [0.6.1] - 2025-08-30
162+
- Added comprehensive test data generation commands for developers and testers
163+
- Implemented `SCTT: Generate Test Data (Dev)` command that creates 90 days of realistic test data
164+
- Added `SCTT: Delete Test Data (Dev)` command for safe cleanup of test data
165+
- Test commands are hidden from end users by default and only visible when `enableDevCommands` setting is enabled
166+
- Enhanced security with configuration-controlled command visibility
167+
- Improved testing workflow for packaged extension installations
168+
- Added progress indicators for test data generation process
169+
170+
### [0.6.0] - 2025-08-28
171+
- Added comprehensive language tracking to monitor time spent in different programming languages
172+
- Automatic language detection based on file extensions and VS Code language IDs
173+
- Support for 50+ programming languages including JavaScript, TypeScript, Python, Java, C++, and more
174+
- Enhanced search and filtering capabilities to include language-based filtering
175+
- Language distribution visualization in summary charts
176+
- All existing functionality preserved with seamless migration of historical data
139177

140178
### [0.5.0] - 2025-08-02
141179
- Added comprehensive health notification system with customizable intervals

TECHNICAL.md

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,70 @@ For detailed contribution guidelines, please see [CONTRIBUTING.md](CONTRIBUTING.
206206

207207
### Generate Test Data
208208

209-
The extension includes a script to generate test data for development: [ON PROGRESS]
209+
The extension includes built-in commands to generate comprehensive test data for development and testing purposes. These commands are hidden from end users by default and only available when explicitly enabled.
210210

211-
```bash
212-
npm run generate-test-data
211+
#### Enabling Test Data Commands
212+
213+
**Method 1: Via Settings UI**
214+
1. Open VS Code Settings (`Ctrl+,`)
215+
2. Search for `"enableDevCommands"`
216+
3. Check the box for "Simple Coding Time Tracker › Enable Dev Commands"
217+
218+
**Method 2: Via settings.json**
219+
```json
220+
{
221+
"simpleCodingTimeTracker.enableDevCommands": true
222+
}
213223
```
214224

215-
This will create sample time entries for the last 90 days with varied projects and durations.
225+
#### Available Test Commands
226+
227+
Once enabled, the following commands become available in the Command Palette (`Ctrl+Shift+P`):
228+
229+
**`SCTT: Generate Test Data (Dev)`**
230+
- Creates comprehensive test data for the last 90 days
231+
- Generates 150-200 realistic time entries
232+
- Includes 10 different projects, 12 Git branches, and 20 programming languages
233+
- Session durations range from 15 minutes to 3 hours
234+
- Automatically skips some days to simulate realistic patterns
235+
236+
**`SCTT: Delete Test Data (Dev)`**
237+
- Safely removes ALL time tracking data with confirmation prompts
238+
- Requires typing "DELETE ALL DATA" for safety
239+
- Cannot be undone - use with caution
240+
241+
#### Test Data Structure
242+
243+
Generated test data includes:
244+
```javascript
245+
{
246+
date: "2025-08-30", // ISO date string
247+
project: "React Dashboard", // Random project name
248+
timeSpent: 120, // Minutes (15-180 range)
249+
branch: "feature/dashboard", // Git branch name
250+
language: "typescript" // Programming language
251+
}
252+
```
253+
254+
#### Security Features
255+
256+
- **Hidden by default**: Commands don't appear for end users
257+
- **Configuration controlled**: Only visible when setting is enabled
258+
- **Development mode fallback**: Always available in extension development
259+
- **Clear labeling**: Commands marked with "(Dev)" suffix
260+
- **Warning messages**: Shows helpful errors if commands are disabled
261+
262+
#### Testing Workflow
263+
264+
1. **Package your extension**: `npm run package`
265+
2. **Install the package**: `code --install-extension your-package.vsix`
266+
3. **Enable dev commands**: Set `enableDevCommands` to `true` in settings
267+
4. **Generate test data**: Use `SCTT: Generate Test Data (Dev)` command
268+
5. **Test extension features**: Verify charts, filtering, search functionality
269+
6. **Clean up**: Use `SCTT: Delete Test Data (Dev)` to remove test data
270+
7. **Disable dev commands**: Set `enableDevCommands` to `false`
271+
272+
This approach ensures test data generation works correctly with packaged extensions while keeping the functionality completely hidden from end users.
216273

217274
### Marketplace Publishing Tests
218275

package.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "simple-coding-time-tracker",
33
"displayName": "Simple Coding Time Tracker",
44
"description": "Track and visualize your coding time across projects",
5-
"version": "0.5.1",
5+
"version": "0.6.0",
66
"publisher": "noorashuvo",
77
"license": "MIT",
88
"icon": "icon-sctt.png",
@@ -64,6 +64,12 @@
6464
"minimum": 30,
6565
"maximum": 480,
6666
"description": "Coding duration before suggesting a break (minutes) - Based on ultradian rhythms"
67+
},
68+
"simpleCodingTimeTracker.enableDevCommands": {
69+
"type": "boolean",
70+
"default": false,
71+
"description": "Enable development commands (Generate/Delete Test Data). Only enable this for testing purposes.",
72+
"scope": "application"
6773
}
6874
}
6975
},
@@ -83,6 +89,16 @@
8389
{
8490
"command": "simpleCodingTimeTracker.toggleHealthNotifications",
8591
"title": "SCTT: Toggle Health Notifications"
92+
},
93+
{
94+
"command": "simpleCodingTimeTracker.generateTestData",
95+
"title": "SCTT: Generate Test Data (Dev)",
96+
"when": "config.simpleCodingTimeTracker.enableDevCommands"
97+
},
98+
{
99+
"command": "simpleCodingTimeTracker.deleteTestData",
100+
"title": "SCTT: Delete Test Data (Dev)",
101+
"when": "config.simpleCodingTimeTracker.enableDevCommands"
86102
}
87103
]
88104
},
@@ -94,7 +110,6 @@
94110
"pretest": "npm run compile && npm run lint",
95111
"lint": "eslint src --ext ts",
96112
"test": "node ./out/test/runTest.js",
97-
"generate-test-data": "node scripts/generate-test-data.js",
98113
"refresh-extension": "code --uninstall-extension noorashuvo.simple-coding-time-tracker && vsce package && code --install-extension $(npm pack --quiet)"
99114
},
100115
"devDependencies": {

0 commit comments

Comments
 (0)