Skip to content

Latest commit

 

History

History
203 lines (147 loc) · 5.05 KB

File metadata and controls

203 lines (147 loc) · 5.05 KB

Contributing to Gleeb LSP

Thank you for your interest in contributing to Gleeb! This guide will help you get started.

Getting Started

  1. Fork the repository (when it's moved to its own repo)
  2. Clone your fork locally
  3. Install dependencies: npm install
  4. Build the project: npm run build
  5. Run tests: npm test (when tests are added)

Development Workflow

Setting Up Development Environment

# Clone the repository
git clone <your-fork-url>
cd gleeb

# Install dependencies
npm install

# Start development with watch mode
npm run watch

# In another terminal, test the server
npm start

Making Changes

  1. Create a feature branch: git checkout -b feature/your-feature-name
  2. Make your changes in the src/ directory
  3. Test your changes thoroughly
  4. Build the project: npm run build
  5. Commit your changes: git commit -m "Add your feature"
  6. Push to your fork: git push origin feature/your-feature-name
  7. Create a pull request

Code Structure

src/
├── server.ts         # Main LSP server implementation
├── completion.ts     # Code completion provider
├── diagnostics.ts    # Diagnostic analysis
└── hover.ts          # Hover information provider

Adding New Features

Adding Widget Support

To add a new Fern widget to the completion system:

  1. Add to completion.ts:

    private static fernWidgets = [
        'Text', 'Button', 'TextInput', 'YourNewWidget', // Add here
        // ... other widgets
    ];
  2. Add documentation to hover.ts:

    private static fernDocumentation = new Map<string, string>([
        ['YourNewWidget', '```cpp\nYourNewWidget(config)\n```\n\nDescription of your widget.'],
        // ... other documentation
    ]);

Adding Function Support

To add a new Fern function:

  1. Add to completion.ts:

    private static fernFunctions = [
        'initialize', 'getWidth', 'yourNewFunction', // Add here
        // ... other functions
    ];
  2. Add hover documentation in hover.ts

  3. Add diagnostic rules in diagnostics.ts if needed

Adding Diagnostic Rules

To add new diagnostic checks:

  1. Edit diagnostics.ts:
    public static validateDocument(document: TextDocument, settings: GleebSettings): Diagnostic[] {
        const diagnostics: Diagnostic[] = [];
        
        // Your new diagnostic check
        if (yourCondition) {
            diagnostics.push({
                severity: DiagnosticSeverity.Warning,
                range: Range.create(Position.create(line, 0), Position.create(line, 0)),
                message: 'Your diagnostic message',
                source: 'gleeb'
            });
        }
        
        return diagnostics;
    }

Testing

Manual Testing

Use the provided test_example.cpp file to manually test LSP features:

# Start the server
./start-server.sh

# Open test_example.cpp in your LSP-compatible editor
# Test completion, diagnostics, and hover features

Adding Automated Tests

When adding automated tests:

  1. Create test files in a tests/ directory
  2. Use Jest for testing framework
  3. Test each LSP feature separately
  4. Mock LSP client interactions

Code Style

  • TypeScript: Use TypeScript for all source files
  • Formatting: Use consistent formatting (consider adding Prettier)
  • Comments: Add JSDoc comments for public methods
  • Error Handling: Always handle errors gracefully

Commit Messages

Follow conventional commit format:

  • feat: add new widget completion support
  • fix: resolve hover documentation issue
  • docs: update README with new features
  • test: add completion provider tests
  • refactor: improve diagnostic performance

Review Process

  1. All changes must be reviewed via pull request
  2. Tests must pass (when CI is set up)
  3. Documentation must be updated for new features
  4. Breaking changes must be clearly documented

Release Process

  1. Version bump in package.json
  2. Update CHANGELOG (when added)
  3. Create release notes
  4. Publish to npm (when ready)

Getting Help

  • Issues: Report bugs and request features via GitHub issues
  • Discussions: Ask questions in GitHub discussions
  • Discord: Join the Fern community Discord (link TBD)

Areas for Contribution

High Priority

  • Go-to-definition support
  • Find references functionality
  • Workspace symbol search
  • Code actions (quick fixes)
  • Enhanced diagnostics

Medium Priority

  • Snippet support
  • Multi-file analysis
  • Configuration validation
  • Performance optimizations

Low Priority

  • Syntax highlighting grammar
  • Documentation generation
  • Plugin for other editors
  • CI/CD pipeline

Code of Conduct

Be respectful, inclusive, and constructive in all interactions. We're building this together!

License

By contributing to Gleeb, you agree that your contributions will be licensed under the MIT License.


Thank you for contributing to Gleeb! 🎉