๐ค Contributing to LookAtni File Markers¶
Welcome to the LookAtni File Markers project! We're excited that you're interested in contributing. This guide will help you get started with contributing to our VS Code extension and documentation.
๐ฏ Ways to Contribute¶
๐ Report Bugs¶
Help us improve by reporting bugs you encounter:
- Check existing issues first to avoid duplicates
- Use the bug report template when creating new issues
- Include reproduction steps and environment details
- Provide sample files when relevant
Bug Report Template¶
**Description**
A clear description of the bug.
**Steps to Reproduce**
1. Go to '...'
2. Click on '...'
3. See error
**Expected Behavior**
What you expected to happen.
**Actual Behavior**
What actually happened.
**Environment**
- OS: [e.g. Windows 10, macOS 12, Ubuntu 20.04]
- VS Code Version: [e.g. 1.80.0]
- Extension Version: [e.g. 1.0.6]
**Additional Context**
Any other relevant information.
๐ก Suggest Features¶
We welcome feature suggestions:
- Search existing feature requests to avoid duplicates
- Use the feature request template
- Explain the use case and business value
- Provide implementation ideas if you have them
Feature Request Template¶
**Is your feature request related to a problem?**
A clear description of the problem.
**Describe the solution you'd like**
A clear description of what you want to happen.
**Describe alternatives you've considered**
Other solutions you've considered.
**Additional context**
Any other context about the feature request.
๐ง Contribute Code¶
Getting Started¶
- Fork the repository on GitHub
-
Clone your fork locally:
-
Install dependencies:
-
Set up development environment:
-
Open in VS Code:
-
Press F5 to launch Extension Development Host
Development Workflow¶
-
Create a feature branch:
-
Make your changes following our coding standards
-
Test your changes:
-
Commit your changes:
-
Push to your fork:
-
Create a Pull Request on GitHub
๐ Improve Documentation¶
Documentation improvements are always welcome:
- Fix typos and grammar errors
- Add missing examples and clarifications
- Improve existing tutorials and guides
- Create new tutorials for advanced features
- Update screenshots and visual content
Documentation Structure¶
docs-site/docs/
โโโ index.md # Homepage
โโโ features/ # Feature documentation
โโโ guide/ # User guides and tutorials
โโโ advanced/ # Advanced topics
โโโ about/ # Project information
โโโ examples/ # Real-world examples
Running Documentation Locally¶
๐จ Code Style Guide¶
TypeScript Guidelines¶
File Organization¶
// 1. Imports - grouped and sorted
import * as vscode from 'vscode';
import * as fs from 'fs';
import * as path from 'path';
import { ConfigManager } from '../utils/configManager';
import { Logger } from '../utils/logger';
// 2. Types and interfaces
interface MarkerOptions {
includeMetadata: boolean;
compressionLevel: number;
}
// 3. Constants
const DEFAULT_OPTIONS: MarkerOptions = {
includeMetadata: true,
compressionLevel: 1
};
// 4. Main implementation
export class MarkerGenerator {
// Implementation
}
Naming Conventions¶
// Classes: PascalCase
class MarkerGenerator {}
// Functions and variables: camelCase
function generateMarkers() {}
const fileCount = 10;
// Constants: UPPER_SNAKE_CASE
const MAX_FILE_SIZE = 1024 * 1024;
// Interfaces: PascalCase with 'I' prefix (optional)
interface IMarkerConfig {}
// or simply
interface MarkerConfig {}
// Enums: PascalCase
enum FileType {
Text,
Binary,
Archive
}
Function Documentation¶
/**
* Generates marker files for the specified directory.
*
* @param sourcePath - The path to the source directory
* @param options - Configuration options for marker generation
* @returns Promise that resolves to the generated marker file path
*
* @example
* ```typescript
* const markerPath = await generateMarkers('/path/to/project', {
* includeMetadata: true,
* compressionLevel: 2
* });
* ```
*/
async function generateMarkers(
sourcePath: string,
options: MarkerOptions
): Promise<string> {
// Implementation
}
Error Handling¶
// Use specific error types
class MarkerGenerationError extends Error {
constructor(
message: string,
public readonly sourcePath: string,
public readonly originalError?: Error
) {
super(message);
this.name = 'MarkerGenerationError';
}
}
// Handle errors gracefully
try {
const result = await generateMarkers(sourcePath, options);
return result;
} catch (error) {
if (error instanceof MarkerGenerationError) {
Logger.error(`Failed to generate markers: ${error.message}`);
throw error;
} else {
Logger.error(`Unexpected error: ${error}`);
throw new MarkerGenerationError(
'Unexpected error during marker generation',
sourcePath,
error
);
}
}
VS Code Extension Guidelines¶
Command Implementation¶
// Command registration
export function activate(context: vscode.ExtensionContext) {
const disposable = vscode.commands.registerCommand(
'lookatni.generateMarkers',
async (uri?: vscode.Uri) => {
try {
await generateMarkersCommand(uri);
} catch (error) {
vscode.window.showErrorMessage(
`Failed to generate markers: ${error.message}`
);
}
}
);
context.subscriptions.push(disposable);
}
// Command implementation
async function generateMarkersCommand(uri?: vscode.Uri): Promise<void> {
const sourcePath = uri?.fsPath || vscode.workspace.rootPath;
if (!sourcePath) {
throw new Error('No workspace folder selected');
}
// Show progress
await vscode.window.withProgress({
location: vscode.ProgressLocation.Notification,
title: 'Generating markers...',
cancellable: true
}, async (progress, token) => {
// Implementation with progress updates
progress.report({ increment: 0, message: 'Scanning files...' });
// Check for cancellation
if (token.isCancellationRequested) {
return;
}
// Continue implementation...
});
}
Configuration Management¶
// Type-safe configuration access
interface ExtensionConfig {
includeMetadata: boolean;
compressionLevel: number;
excludePatterns: string[];
}
function getConfiguration(): ExtensionConfig {
const config = vscode.workspace.getConfiguration('lookatni');
return {
includeMetadata: config.get<boolean>('includeMetadata', true),
compressionLevel: config.get<number>('compressionLevel', 1),
excludePatterns: config.get<string[]>('excludePatterns', [])
};
}
๐งช Testing Guidelines¶
Unit Tests¶
// test/unit/markerGenerator.test.ts
import * as assert from 'assert';
import { MarkerGenerator } from '../../src/utils/markerGenerator';
describe('MarkerGenerator', () => {
let generator: MarkerGenerator;
beforeEach(() => {
generator = new MarkerGenerator();
});
it('should generate markers for simple project', async () => {
const result = await generator.generate('/test/project');
assert.ok(result);
assert.ok(result.includes('// === File:'));
});
it('should handle binary files correctly', async () => {
// Test implementation
});
});
Integration Tests¶
// test/integration/extension.test.ts
import * as vscode from 'vscode';
import * as assert from 'assert';
describe('Extension Integration Tests', () => {
it('should activate extension successfully', async () => {
const extension = vscode.extensions.getExtension('rafa-mori.lookatni-file-markers');
assert.ok(extension);
await extension.activate();
assert.ok(extension.isActive);
});
it('should register all commands', async () => {
const commands = await vscode.commands.getCommands();
assert.ok(commands.includes('lookatni.generateMarkers'));
assert.ok(commands.includes('lookatni.extractFiles'));
// ... test other commands
});
});
Running Tests¶
# Run all tests
npm test
# Run specific test file
npm test -- --grep "MarkerGenerator"
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch
๐ Pull Request Guidelines¶
Before Submitting¶
-
Ensure all tests pass:
-
Check code formatting:
-
Update documentation if needed
-
Add tests for new functionality
-
Update changelog for significant changes
Pull Request Template¶
## Description
Brief description of changes made.
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## Testing
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
## Checklist
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
Review Process¶
- Automated checks must pass (CI/CD pipeline)
- Code review by maintainers
- Testing in development environment
- Documentation review if applicable
- Final approval and merge
๐๏ธ Project Structure¶
Core Extension¶
src/
โโโ extension.ts # Main extension entry point
โโโ commands/ # VS Code commands
โ โโโ generateMarkers.ts
โ โโโ extractFiles.ts
โ โโโ validateMarkers.ts
โ โโโ ...
โโโ utils/ # Utility modules
โ โโโ configManager.ts
โ โโโ logger.ts
โ โโโ markerGenerator.ts
โ โโโ ...
โโโ views/ # VS Code views and providers
โ โโโ explorerProvider.ts
โโโ test/ # Test files
โโโ unit/
โโโ integration/
โโโ fixtures/
Documentation¶
docs-site/
โโโ docs/ # Documentation content
โโโ mkdocs.yml # MkDocs configuration
โโโ pyproject.toml # Python dependencies
โโโ overrides/ # Custom templates and assets
Configuration Files¶
โโโ package.json # Extension manifest and dependencies
โโโ tsconfig.json # TypeScript configuration
โโโ eslint.config.mjs # ESLint configuration
โโโ esbuild.js # Build configuration
โโโ .github/ # GitHub workflows and templates
๐ Release Process¶
Version Numbering¶
We follow Semantic Versioning:
- MAJOR.MINOR.PATCH (e.g., 1.0.6)
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
Release Steps¶
- Update version in
package.json - Update changelog with new features and fixes
-
Create release branch:
-
Final testing and validation
- Create GitHub release with release notes
- Publish to VS Code Marketplace:
๐ค Community Guidelines¶
Code of Conduct¶
- Be respectful and inclusive
- Be constructive in feedback and discussions
- Be patient with new contributors
- Be helpful and supportive
Communication Channels¶
- GitHub Issues: Bug reports and feature requests
- GitHub Discussions: General questions and community discussion
- Pull Request Reviews: Code-related discussions
Recognition¶
Contributors are recognized in:
- Changelog: Credit for significant contributions
- README: Contributors section
- Release Notes: Special mentions for major contributions
๐ Learning Resources¶
Getting Started with VS Code Extensions¶
TypeScript Resources¶
Testing Resources¶
Thank you for contributing to LookAtni File Markers! Your contributions help make this tool better for everyone. ๐