Thank you for your interest in contributing to the NullScript Intelligence VS Code extension! This guide will help you get started with development and contributing to the project.
Before you begin, ensure you have the following installed:
- Node.js 16+ and npm
- Visual Studio Code 1.74.0 or higher
- Git for version control
- Basic knowledge of TypeScript and VS Code Extension API
-
Fork the Repository
Fork the repository on GitHub and clone your fork:
git clone https://github.com/nullscript-lang/nullscript-intelligence.git cd nullscript-intelligence -
Install Dependencies
npm install
-
Compile TypeScript
# One-time compilation npm run compile # Watch mode for development npm run watch
-
Run the Extension
- Open the project in VS Code
- Press
F5to start debugging - This opens a new Extension Development Host window
- Create a
.nsfile to test the extension
vscode-extension/
├── src/
│ ├── extension.ts # Main extension entry point
│ ├── keywords.ts # NullScript keyword definitions
│ └── interface.ts # TypeScript interfaces
├── snippets/
│ └── nullscript.json # Code snippets
├── syntaxes/
│ └── nullscript.tmLanguage.json # Syntax highlighting rules
├── images/ # Extension icons
├── package.json # Extension manifest
├── language-configuration.json # Language configuration
├── tsconfig.json # TypeScript configuration
└── README.md # Extension documentation
src/extension.ts: Contains the main extension logic including completion and hover providerssrc/keywords.ts: Defines all NullScript keywords with their JavaScript equivalents, descriptions, and examplessrc/interface.ts: TypeScript interfaces for type safetypackage.json: Extension manifest defining activation events, contributions, and metadatasnippets/nullscript.json: Code snippets for common NullScript patterns
We welcome various types of contributions:
- Fix auto-completion issues
- Resolve hover documentation problems
- Address syntax highlighting bugs
- Improve error handling
- Add support for new NullScript keywords
- Improve completion intelligence
- Enhance hover documentation
- Add new code snippets
- Create design pattern templates
- Improve code comments and JSDoc
- Update README and guides
- Add usage examples
- Create tutorial content
- Performance testing
- Cross-platform validation
-
Create a Feature Branch
git checkout -b feature/your-feature-name # or git checkout -b fix/bug-description -
Make Your Changes
- Follow the coding standards below
- Add appropriate tests
- Update documentation as needed
-
Test Your Changes
# Compile and check for TypeScript errors npm run compile # Test manually in Extension Development Host # Press F5 in VS Code # Package to verify build npm run package
-
Commit Your Changes
Use conventional commit messages:
git add . git commit -m "feat: add completion for new keyword 'example'" # or git commit -m "fix: resolve hover documentation issue" # or git commit -m "docs: update contributing guidelines"
-
Push and Create Pull Request
git push origin feature/your-feature-name
Then create a pull request on GitHub with:
- Clear description of changes
- Screenshots or GIFs for UI changes
- Reference to any related issues
- Testing notes
// Use meaningful names and proper typing
class NullScriptCompletionProvider implements vscode.CompletionItemProvider {
// Add JSDoc comments for public methods
/**
* Provides completion items for NullScript keywords and methods
* @param document The text document being edited
* @param position The cursor position
* @returns Promise of completion items array
*/
async provideCompletionItems(
document: vscode.TextDocument,
position: vscode.Position
): Promise<vscode.CompletionItem[]> {
// Implementation here
}
// Use private methods for internal logic
private getKeywordCompletions(): vscode.CompletionItem[] {
// Implementation here
}
}- Indentation: Use 2 spaces (not tabs)
- Naming: Use camelCase for variables and functions, PascalCase for classes
- Comments: Add JSDoc comments for public methods and interfaces
- Error Handling: Include proper try-catch blocks and error logging
- Type Safety: Use TypeScript types and avoid
anywhen possible
When adding new NullScript keywords, follow this pattern in src/keywords.ts:
{
nullscript: "yournewkeyword",
javascript: "javascriptequivalent",
category: KeywordCategory.APPROPRIATE_CATEGORY,
description: "Clear description of what this keyword does",
syntax: "yournewkeyword (parameters) { ... }",
example: "yournewkeyword (x > 5) { speak.say('Hello'); }"
}Add new snippets to snippets/nullscript.json:
{
"Your Snippet Name": {
"prefix": "triggerkeyword",
"body": [
"line1 ${1:placeholder}",
"line2 ${2:placeholder}",
" $0"
],
"description": "Description of what this snippet does"
}
}Before submitting a pull request, verify:
- Extension activates properly for
.nsfiles - Auto-completion works for your changes
- Hover documentation displays correctly
- Syntax highlighting is accurate
- No console errors in Extension Development Host
- Performance remains responsive
- Works across different VS Code themes
Extension Not Activating
- Check
activationEventsinpackage.json - Verify file has
.nsextension - Check for TypeScript compilation errors
Completions Not Showing
- Ensure language ID is set to "nullscript"
- Check completion provider registration
- Verify trigger characters are correct
Hover Not Working
- Ensure keyword exists in
KEYWORDSarray - Check hover provider registration
- Verify word detection logic
- VS Code Developer Tools:
Help > Toggle Developer Tools - Extension Host Console: Check for runtime errors
- Output Panel: Select "NullScript Intelligence" from dropdown
- Debug Console: Use when running in debug mode
Add temporary logging for debugging (remove before committing):
console.log('Debug info:', variable);- GitHub Issues: For bug reports and feature requests
- GitHub Discussions: For questions and general discussion
- Pull Request Reviews: For code-related discussions
When reporting bugs, please include:
-
Environment Information
- VS Code version
- Extension version
- Operating system
- Node.js version
-
Steps to Reproduce
- Clear step-by-step instructions
- Sample code that reproduces the issue
- Expected vs actual behavior
-
Additional Context
- Screenshots or screen recordings
- Console error messages
- Related extensions installed
When creating a pull request, please include:
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Refactoring
- [ ] Performance improvement
## Testing
- [ ] Manual testing completed
- [ ] No console errors
- [ ] Cross-platform testing (if applicable)
## Screenshots/GIFs
(if applicable)
## Related Issues
Fixes #(issue number)Contributors will be:
- Listed in the project's contributors
- Mentioned in release notes for significant contributions
- Given credit in documentation they help improve
Thank you for contributing to NullScript Intelligence! Your efforts help make NullScript development more enjoyable for everyone. 🎭✨
Questions? Feel free to open an issue or start a discussion on GitHub!