I welcome any issues or PRs :)
- Clone the repo
- Install the relevant dependencies
- VS Code Insiders (needed to run the tests from CLI, see using Insiders version for extension development)
- Node 20, which comes automatically bundled with npm 8, another dependency.
npm i
- Use
bash
to run the npm scripts. They use commands that are not compatible with PowerShell. Use this setting:"terminal.integrated.defaultProfile.windows": "Git Bash"
If you use Command Prompt or PowerShell, you may see errors like
'rm' is not recognized as an internal or external command, operable program or batch file.
This repo enforces formatting, so it's recommended to format on save:
See language-specific editor settings
// settings.json - https://code.visualstudio.com/docs/getstarted/settings#_settingsjson
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"terminal.integrated.defaultProfile.windows": "Git Bash",
"[ahk]": {
"editor.defaultFormatter": "mark-wiemer.vscode-autohotkey-plus-plus",
},
}
To verify your fix worked as expected, we recommend following test-driven development
- Identify a bug you'd like to fix
- Write a test that fails with the current code due to that bug
- Update the code to pass the test
- Repeat the above process with more and more complex test cases
- Clean up the code
- Commit the code
This way, we'll alway have a test to ensure we don't re-introduce a bug
Please validate the build before opening a PR. Automated checks will have to pass before the PR can be merged.
npm run validate
for automated checks- Go to
Run and Debug
viewlet (Ctrl+Shift+D
) and click "Run Extension" for manual checks
All checks are found in 📄 package.json#scripts
.
- Validate: Make sure everything is working correctly
- Lint
- TSC: TypeScript compiler checks for compile-time issues
- ESLint: ESLint checks code quality
- Format: Prettier checks code formatting
- PackageJSON:
sort-package-json
checkspackage.json
property order
- Test
- Pretest (compile)
- TS: TypeScript compiler "upserts"
.js
files that are executed - Grammar: js-yaml converts language syntax from YAML to JSON
- TS: TypeScript compiler "upserts"
- Automated tests: Mocha checks functionality
- Pretest (compile)
- Lint
The syntax in 📄 language/ahk.tmLanguage.yaml
determines how syntax highlighting is applied.
; No syntax highlighting here 😞
; This comment is colored green thanks to syntax highlighting 🌈
Some resources:
- See the official syntax highlight guide for more details about how this works.
- We use
PanAeon/vscode-tmgrammar-test
for testing the grammar. - If you're curious,
microsoft/vscode-textmate
hosts the tokenization grammar.
To update the syntax, we recommend following this flow:
- 🤔 Take some time to reproduce a syntax highlighting issue with as little AHK code as possible
- ➕ Add a new file in 📁
src/test/suite/grammar/samples
that demonstrates the issue - 🏃 Run
npm run test_grammar
to generate a.snap
snapshot for the file you added - ✏️ Edit the YAML grammar
- 🧪 Repeat the last two steps until everything is working as you want
PanAeon/vscode-tmgrammar-test
has great documentation on how to test the syntax