Thank you for your interest in contributing to the Rhai Language Support plugin for JetBrains IDEs! This document provides guidelines and instructions for contributing.
- JDK 17+ - Required for building the plugin
- IntelliJ IDEA - Recommended for development (Community or Ultimate)
- Git - For version control
-
Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/rhai-jetbrains-plugin.git cd rhai-jetbrains-plugin -
Open in IntelliJ IDEA
- Open IntelliJ IDEA
- Select "Open" and navigate to the cloned directory
- Wait for Gradle to sync
-
Build the plugin
./gradlew buildPlugin
-
Run the plugin in a sandbox IDE
./gradlew runIde
src/
├── main/
│ ├── grammars/ # BNF grammar (Rhai.bnf) and JFlex lexer (RhaiLexer.flex)
│ ├── kotlin/org/rhai/
│ │ ├── features/ # Completion, folding, formatting, structure view
│ │ ├── highlighting/ # Syntax highlighter
│ │ ├── inspections/ # Code inspections and quick fixes
│ │ ├── intentions/ # Intention actions
│ │ ├── lang/ # Language and file type definitions
│ │ ├── navigation/ # Go to declaration
│ │ ├── parser/ # Parser definition
│ │ ├── refactoring/ # Rename refactoring
│ │ ├── registry/ # Rust integration
│ │ ├── run/ # Run configuration
│ │ ├── settings/ # Settings pages
│ │ └── util/ # Utility classes
│ └── resources/
│ ├── META-INF/ # Plugin descriptor (plugin.xml)
│ ├── icons/ # Plugin icons
│ └── liveTemplates/ # Live template definitions
└── test/
└── kotlin/org/rhai/ # Unit tests
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Follow existing code style and patterns
- Add tests for new functionality
- Update documentation if needed
-
Run tests
./gradlew test -
Run code quality checks
./gradlew detekt
-
Verify plugin compatibility
./gradlew verifyPlugin
If you modify the grammar files:
- Edit
src/main/grammars/Rhai.bnffor parser changes - Edit
src/main/grammars/RhaiLexer.flexfor lexer changes - Regenerate parser/lexer:
./gradlew generateParser generateLexer
When adding new IDE features:
- Create implementation class in the appropriate package
- Register the extension in
src/main/resources/META-INF/plugin.xml - Add tests in
src/test/kotlin/org/rhai/ - Update README.md if it's a user-facing feature
- Use Kotlin idioms and conventions
- Prefer immutable data (
valovervar) - Use meaningful names for classes, functions, and variables
- Keep functions small and focused
- Add KDoc comments for public APIs
- Use 4 spaces for indentation
- Maximum line length: 120 characters
- Run
./gradlew detektto check code style
- Classes:
PascalCase(e.g.,RhaiCompletionContributor) - Functions:
camelCase(e.g.,getCompletionVariants) - Constants:
SCREAMING_SNAKE_CASE(e.g.,MAX_SUGGESTIONS) - Files: Match the main class name
- Place tests in
src/test/kotlin/org/rhai/ - Extend
BasePlatformTestCasefor IDE integration tests - Use descriptive test method names
- Cover edge cases and error scenarios
# Run all tests
./gradlew test
# Run specific test class
./gradlew test --tests "org.rhai.parser.RhaiParserTest"
# Run with verbose output
./gradlew test --info-
Ensure all checks pass
./gradlew test detekt verifyPlugin -
Update documentation
- Update README.md for new features
- Update CHANGELOG.md with your changes
-
Create a pull request
- Use a clear, descriptive title
- Reference any related issues
- Describe what changes you made and why
-
Code review
- Address reviewer feedback
- Keep commits clean and focused
Follow conventional commit format:
type(scope): short description
Longer description if needed.
Fixes #123
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Build, CI, or other maintenance
When reporting bugs, please include:
- IDE version and OS
- Plugin version
- Steps to reproduce
- Expected vs actual behavior
- Error messages or stack traces (if any)
- Sample code that triggers the issue
For feature requests, please describe:
- The problem you're trying to solve
- Your proposed solution
- Alternative solutions you considered
If you have questions:
- Check existing issues
- Open a new issue with the "question" label
- Contact the maintainer via email: gleb.mikhailov.04@gmail.com
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing!