From d3e5b50601a17eb2239c7ba70a37e5cbb2be7b33 Mon Sep 17 00:00:00 2001 From: Mark Wiemer <7833360+mark-wiemer@users.noreply.github.com> Date: Thu, 22 Aug 2024 00:05:31 -0700 Subject: [PATCH] =?UTF-8?q?v5.1.0=20=F0=9F=A7=AA=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add pre-release template * Stop ignoring submodule * Stop ignoring submodule for formatting * Ignore ahk2 files again Submodule will format and lint itself moving forward * Add nested formatting * Fixup nested eslint * Document openHelp todo * Update package.json contributes with ahk2 stuff * fixup v2 integration docs * Default to switch to v1 * update subproject * restore pre-commit hook * Add output language * Update docs * update submodule * Update submodule to tip of main * Update docs * Deploy pre-releases * Update docs * Cleanup docs * Pre-releases don't get their own emoji ๐Ÿ˜ค * Fix grammar tests * Update readme with pre-release details * thanks to thqby! * Bump to 5.1.0 * Add formatting test * Compile grammar before packaging * Document known issue with global recognition * Remove ahk2.help, restore ahk++.help * Update sub to tip of main * Final updates! * #lastminute * it's tomorrow! * Use prettier 3.3.3 for consistency with submodule * Disable format check --- .github/ISSUE_TEMPLATE/pre-release.md | 21 + .github/workflows/deploy.yml | 2 + .vscode/dev.code-snippets | 12 +- Changelog.md | 19 + Contributing.md | 4 +- ahk2 | 2 +- .../{formatting.ahk => formatting.ahk1} | 0 demos/manualTests/formatting.ahk2 | 4 + demos/manualTests/run.ahk2 | 2 +- demos/manualTests/runSelection.ahk2 | 2 +- docs/FullV2Integration.md | 143 +++++ eslint.config.mjs | 4 +- language/ahk2-output.tmLanguage.yaml | 64 +++ language/ahk2.configuration.json | 119 +++++ package-lock.json | 23 +- package.json | 504 +++++++++++++++++- readme.md | 47 +- src/extension.ts | 4 +- 18 files changed, 901 insertions(+), 75 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/pre-release.md rename demos/manualTests/{formatting.ahk => formatting.ahk1} (100%) create mode 100644 demos/manualTests/formatting.ahk2 create mode 100644 docs/FullV2Integration.md create mode 100644 language/ahk2-output.tmLanguage.yaml create mode 100644 language/ahk2.configuration.json diff --git a/.github/ISSUE_TEMPLATE/pre-release.md b/.github/ISSUE_TEMPLATE/pre-release.md new file mode 100644 index 00000000..f7854b5e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/pre-release.md @@ -0,0 +1,21 @@ +--- +name: Issues with AHK v2 support +about: Issues specific to AutoHotkey v2. +title: '[Pre-release] ' +labels: pre-release +assignees: mark-wiemer +--- + +- [ ] My issue is different from [other reported pre-release issues](https://github.com/mark-wiemer-org/ahkpp/issues?q=sort%3Aupdated-desc+label%3Apre-release+is%3Aopen) + +**Is your issue related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6aa90346..84e21fd3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,6 +17,7 @@ jobs: with: # Generated via https://open-vsx.org/user-settings/tokens, valid forever? pat: ${{ secrets.OPEN_VSX_TOKEN }} + prerelease: true - name: Publish to Visual Studio Marketplace uses: HaaLeo/publish-vscode-extension@v1 with: @@ -25,3 +26,4 @@ jobs: # Saved locally as "CI VS Code Marketplace Publish Token", expires 2024-06-22 pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} registryUrl: https://marketplace.visualstudio.com + prerelease: true diff --git a/.vscode/dev.code-snippets b/.vscode/dev.code-snippets index c54e6741..8a198be2 100644 --- a/.vscode/dev.code-snippets +++ b/.vscode/dev.code-snippets @@ -31,16 +31,14 @@ " tests.forEach(([name, args, expected]) =>", " test(name, () => assert.strictEqual($1(...args), expected)),", " );", - "});" + "});", ], - "description": "Generate tests for Mocha." + "description": "Generate tests for Mocha.", }, "Issue link (ahkpp)": { "scope": "markdown", "prefix": "[#", - "body": [ - "[#$1](https://github.com/mark-wiemer-org/ahkpp/issues/$1)" - ], - "description": "Link an ahkpp issue" - } + "body": ["[#$1](https://github.com/mark-wiemer-org/ahkpp/issues/$1)"], + "description": "Link an ahkpp issue", + }, } diff --git a/Changelog.md b/Changelog.md index a190df41..99137dd5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,24 @@ # Changelog +## 5.1.0 - 2024-08-22 ๐Ÿงช + +> ๐Ÿงช means this is a [pre-release](https://code.visualstudio.com/updates/v1_63#_pre-release-extensions)! + +This is a very early pre-release, expect significant issues. Commands may not work as expected and features may be missing. + +### Breaking changes + +For [technical reasons](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions), this is tagged with `5.1.0`, but it is a breaking release and the full release will be tagged `6.0.0` + +- I haven't found any yet! Please [๐Ÿ› report any issues](https://github.com/mark-wiemer-org/ahkpp/issues/new/choose) you find ๐Ÿค“ + +### Other changes + +- Add full v2 support via [thqby's AutoHotkey v2 Language Support](https://marketplace.visualstudio.com/items?itemName=thqby.vscode-autohotkey2-lsp) + - No need to install that extension, all features are bundled into this extension + - Future work will de-dupe commands like "debug", "run selection", and "open help" + - Known issues and all new features are documented at [full v2 integration](docs/FullV2Integration.md) + ## 5.0.7 - 2024-08-17 ๐Ÿ˜ฌ - Fix readme: v2 debugger works via commands, just not via "run and debug" viewlet diff --git a/Contributing.md b/Contributing.md index 03fb8847..6601bc48 100644 --- a/Contributing.md +++ b/Contributing.md @@ -30,8 +30,8 @@ See [language-specific editor settings](https://code.visualstudio.com/docs/getst "editor.defaultFormatter": "esbenp.prettier-vscode", "terminal.integrated.defaultProfile.windows": "Git Bash", "[ahk]": { - "editor.defaultFormatter": "mark-wiemer.vscode-autohotkey-plus-plus" - } + "editor.defaultFormatter": "mark-wiemer.vscode-autohotkey-plus-plus", + }, } ``` diff --git a/ahk2 b/ahk2 index bfda9c14..f7548c03 160000 --- a/ahk2 +++ b/ahk2 @@ -1 +1 @@ -Subproject commit bfda9c142c2f558834ccdaa60ef24567df297f54 +Subproject commit f7548c03dbfc5f697a71c66a48846c2198c322f7 diff --git a/demos/manualTests/formatting.ahk b/demos/manualTests/formatting.ahk1 similarity index 100% rename from demos/manualTests/formatting.ahk rename to demos/manualTests/formatting.ahk1 diff --git a/demos/manualTests/formatting.ahk2 b/demos/manualTests/formatting.ahk2 new file mode 100644 index 00000000..4109f94e --- /dev/null +++ b/demos/manualTests/formatting.ahk2 @@ -0,0 +1,4 @@ +#Requires AutoHotkey v2 + +; Shift+Alt+F to format + ExitApp() \ No newline at end of file diff --git a/demos/manualTests/run.ahk2 b/demos/manualTests/run.ahk2 index 957fd213..c1f98cca 100644 --- a/demos/manualTests/run.ahk2 +++ b/demos/manualTests/run.ahk2 @@ -5,4 +5,4 @@ MsgBox("You did it!") -ExitApp() +ExitApp() \ No newline at end of file diff --git a/demos/manualTests/runSelection.ahk2 b/demos/manualTests/runSelection.ahk2 index 9a7e8f76..fff51168 100644 --- a/demos/manualTests/runSelection.ahk2 +++ b/demos/manualTests/runSelection.ahk2 @@ -5,4 +5,4 @@ MsgBox("1") ; Select the following two lines and hit `Ctrl + F8` to run selection MsgBox("2") -ExitApp() +ExitApp() \ No newline at end of file diff --git a/docs/FullV2Integration.md b/docs/FullV2Integration.md new file mode 100644 index 00000000..06ebed97 --- /dev/null +++ b/docs/FullV2Integration.md @@ -0,0 +1,143 @@ +# Full v2 integration + +This doc covers all the new features as a result of integrating with thqby's AHK v2 Language Support extension. See [known issues](#known-issues) at the bottom of this file + +## The big changes + +- Formatting support +- Better v2 IntelliSense support: rename, hover, and more + +## package.json contributions + +### Commands + +- ahk2.debug (dupe of ahk++.debug) +- ahk2.debug.attach +- ahk2.debug.params +- ahk2.diagnostic.full +- ahk2.export.symbols +- ahk2.run (dupe of ahk++.run) +- ahk2.selection.run (dupe of ahk++.runSelection) +- ahk2.stop +- ahk2.compile (dupe of ahk++.compile) +- ahk2.generate.comment +- ahk2.updateversioninfo +- ahk2.switch +- ahk2.selectSyntaxes +- ahk2.setscriptdir + +### Configuration + +- AutoHotkey2.AutoLibInclude +- AutoHotkey2.CommentTags +- AutoHotkey2.CompilerCMD +- AutoHotkey2.CompleteFunctionParens +- AutoHotkey2.DebugConfiguration +- AutoHotkey2.Diagnostics.ClassNonDynamicMemberCheck +- AutoHotkey2.Diagnostics.ParamsCheck +- AutoHotkey2.Warn.VarUnset +- AutoHotkey2.Warn.LocalSameAsGlobal +- AutoHotkey2.Warn.CallWithoutParentheses +- AutoHotkey2.ActionWhenV1IsDetected (now defaults to "Switch to v1" instead of "Warn") +- AutoHotkey2.CompletionCommitCharacters +- AutoHotkey2.Files.Exclude +- AutoHotkey2.Files.ScanMaxDepth +- AutoHotkey2.FormatOptions +- AutoHotkey2.InterpreterPath +- AutoHotkey2.SymbolFoldingFromOpenBrace +- AutoHotkey2.WorkingDirs +- AutoHotkey2.Syntaxes + +### Configuration defaults + +```json +{ + "[ahk2]": { + "editor.defaultFormatter": "mark-wiemer.vscode-autohotkey-plus-plus", + "editor.quickSuggestions": { + "other": true, + "comments": false, + "strings": true + } + } +} +``` + +### Grammars + +- Added `embeddedLanguages` to `ahk2` +- Added `~ahk2-output` (debug output syntax) + +### Keybindings + +See [commands](#commands) for duplicates + +- ahk2.run +- ahk2.selection.run +- ahk2.compile +- ahk2.debug +- ahk2.debug.params +- ahk2.help +- ahk2.stop + +### Languages + +- ahk2.configuration.json + +### Menus + +See [commands](#commands) for duplicates + +editor/context: + +- ahk2.debug +- ahk2.debug.attach +- ahk2.debug.params +- ahk2.selection.run +- ahk2.run +- ahk2.compile +- ahk2.help +- ahk2.stop +- ahk2.generate.comment +- ahk2.updateversioninfo + +editor/title: + +- ahk2.run +- ahk2.stop +- ahk2.debug + +### Semantic token scopes + +New, added: + +```json +[ + { + "language": "ahk2", + "scopes": { + "operator": ["keyword.operator.wordlike.ahk2"] + } + } +] +``` + +## Known issues + +### Blocking + +These issues will be resolved before a full release + +- Several [commands](#commands) are duplicated. The plan is to retain the current visual style. +- Globals like `MsgBox` and `ExitApp` are not recognized in any file, e.g. [compile.ahk2](../demos/manualTests/compile.ahk2) +- `common.ts#loadahk2` needs work +- Needs more tests!! Many features have not been tested at all, hence the pre-release! +- [Release pipeline](../.github/workflows/deploy.yml) has been changed to push pre-releases. Definitely fix this for the final release ๐Ÿ˜‰ + +### Low priority + +These issues will be backlogged and resolved after a full release + +- App is bloated, including source map files that can be removed. See [ahk2/webpack.config.js](../ahk2/webpack.config.js) +- No newline at end of file when formatting (inconsistent with v1 and industry standards) +- Format check is [failing in the pipeline](https://github.com/mark-wiemer-org/ahkpp/actions/runs/10503320004/job/29096451649?pr=467) diff --git a/eslint.config.mjs b/eslint.config.mjs index ee284fb4..07a11c57 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -4,7 +4,5 @@ import tseslint from 'typescript-eslint'; export default tseslint.config( eslint.configs.recommended, ...tseslint.configs.recommended, - { - ignores: ['out', 'dist', '**/*.d.ts', 'src/ahk2'], - }, + { ignores: ['out', 'dist', '**/*.d.ts', 'ahk2'] }, ); diff --git a/language/ahk2-output.tmLanguage.yaml b/language/ahk2-output.tmLanguage.yaml new file mode 100644 index 00000000..27196a1b --- /dev/null +++ b/language/ahk2-output.tmLanguage.yaml @@ -0,0 +1,64 @@ +name: ahk2-output +scopeName: ahk2.output +patterns: + - include: '#url' + - captures: + '1': + name: token.info-token + '2': + name: string + match: "^(\\[Running\\])(.*)$" + name: ahk2.running + - captures: + '1': + name: token.info-token + '2': + name: string + '3': + name: token.debug-token + '4': + name: token.error-token + '5': + name: string + '6': + name: constant.numeric + '7': + name: string + match: "^(\\[Done\\])(.+)(?:(code=0)|(code=\\d+))([^\\d]+)(\\d+(?:\\.\\d+)?)([^\\d]+)$" + name: ahk2.done + - match: "\\d{1,3}(\\.\\d{1,3}){3}(:\\d+)" + name: constant.numeric + - match: "^(?i:(\\[error\\])|(\\[info\\])|(\\[warn\\]))(.*)" + captures: + '1': + name: token.error-token + '2': + name: token.info-token + '3': + name: token.warn-token + name: ahk2.log + - include: '#numbers' + - include: '#operators' + - include: '#string' +repository: + url: + match: "\\b((?i:(https?|ws)://\\S+))\\b" + name: string.url + numbers: + match: "\\b(\\d+(?:\\.\\d+)?|0[xX][\\da-fA-F]+)\\b" + name: constant.numeric + operators: + patterns: + - match: "&=|\\^=|<<=|>>=|\\|=|\\.=|\\+=|-=|\\*=|(?>|!=|<=|>=|=?=|<|>|&&|!|\\|\\||&|\\||\\^|~|:=|\\*|/|-|\\+" + name: keyword.operator + string: + patterns: + - begin: (['"])(?=.*\1) + beginCaptures: + '1': + name: punctuation.definition.string.begin + end: "(\\1)" + endCaptures: + '1': + name: punctuation.definition.string.end + name: string.quoted diff --git a/language/ahk2.configuration.json b/language/ahk2.configuration.json new file mode 100644 index 00000000..2aa9ed1b --- /dev/null +++ b/language/ahk2.configuration.json @@ -0,0 +1,119 @@ +{ + "comments": { + "lineComment": ";", + "blockComment": ["/*", "*/"] + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["%", "%"], + { + "open": "\"", + "close": "\"", + "notIn": ["string"] + }, + { + "open": "'", + "close": "'", + "notIn": ["string"] + }, + { + "open": "/**", + "close": " */", + "notIn": ["string"] + } + ], + "autoCloseBefore": ":.,}])>'\" \n\t", + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"], + ["%", "%"] + ], + "indentationRules": { + "increaseIndentPattern": "^((?!;).)*(\\{[^}\"'`]*|\\([^)\"'`]*|\\[[^\\]\"'`]*)$", + "decreaseIndentPattern": "^((?!.*?/\\*).*\\*/)?\\s*[\\])}].*$", + "indentNextLinePattern": "^\\s*(((\\}\\s*)?([Ee]lse|[Ff]inally)\\b|[Tt]ry\\b)(?=\\s*([;{].*)?$)|(((\\}\\s*)?([Ee]lse|[Ff]inally)|[Tt]ry)\\s+)?([Ii]f|[Ff]or|[Ww]hile|[Ll]oop)\\b|(\\}\\s*)?[Cc]atch\\b)", + // e.g. * ...| or */| or *-----*/| + "unIndentedLinePattern": { + "pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$" + } + }, + "onEnterRules": [ + { + // e.g. /** | */ + "beforeText": { + "pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$" + }, + "afterText": { + "pattern": "^\\s*\\*/$" + }, + "action": { + "indent": "indentOutdent", + "appendText": " * " + } + }, + { + // e.g. /** ...| + "beforeText": { + "pattern": "^\\s*/\\*\\*(?!/)([^\\*]|\\*(?!/))*$" + }, + "action": { + "indent": "none", + "appendText": " * " + } + }, + { + // e.g. * ...| + "beforeText": { + "pattern": "^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$" + }, + "previousLineText": { + "pattern": "(?=^(\\s*(/\\*\\*|\\*)).*)(?=(?!(\\s*\\*/)))" + }, + "action": { + "indent": "none", + "appendText": "* " + } + }, + { + // e.g. */| + "beforeText": { + "pattern": "^(\\t|[ ])*[ ]\\*/\\s*$" + }, + "action": { + "indent": "none", + "removeText": 1 + } + }, + { + // e.g. *-----*/| + "beforeText": { + "pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$" + }, + "action": { + "indent": "none", + "removeText": 1 + } + }, + { + "beforeText": { + "pattern": "^\\s*(\\b[cC]ase\\s.+:|\\b[dD]efault:)$" + }, + "afterText": { + "pattern": "^(?!\\s*(\\b[cC]ase\\b|\\b[dD]efault\\b))" + }, + "action": { + "indent": "indent" + } + } + ] +} diff --git a/package-lock.json b/package-lock.json index 899a5131..0c48e470 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vscode-autohotkey-plus-plus", - "version": "5.0.7", + "version": "5.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vscode-autohotkey-plus-plus", - "version": "5.0.7", + "version": "5.1.0", "license": "See license.txt", "dependencies": { "@vscode/debugadapter": "^1.57.0", @@ -36,7 +36,7 @@ "js-yaml": "^4.1.0", "lint-staged": "^14.0.1", "mocha": "^10.0.0", - "prettier": "2.6.1", + "prettier": "3.3.3", "sort-package-json": "^1.57.0", "source-map-support": "^0.5.19", "typescript": "~4.7.4", @@ -5600,15 +5600,16 @@ } }, "node_modules/prettier": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.1.tgz", - "integrity": "sha512-8UVbTBYGwN37Bs9LERmxCPjdvPxlEowx2urIL6urHzdb3SDq4B/Z6xLFCblrSnE4iKWcS6ziJ3aOYrc1kz/E2A==", + "version": "3.3.3", + "resolved": "https://registry.npmmirror.com/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, + "license": "MIT", "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" @@ -10707,9 +10708,9 @@ "dev": true }, "prettier": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.1.tgz", - "integrity": "sha512-8UVbTBYGwN37Bs9LERmxCPjdvPxlEowx2urIL6urHzdb3SDq4B/Z6xLFCblrSnE4iKWcS6ziJ3aOYrc1kz/E2A==", + "version": "3.3.3", + "resolved": "https://registry.npmmirror.com/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true }, "process-nextick-args": { diff --git a/package.json b/package.json index f86e7102..1776a964 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "vscode-autohotkey-plus-plus", "displayName": "AutoHotkey Plus Plus", - "version": "5.0.7", - "description": "AutoHotkey language support for Visual Studio Code: IntelliSense, debugging, formatting, and more. AHK v1 fully supported, v2 in preview.", + "version": "5.1.0", + "description": "AutoHotkey v1 and v2 language support for Visual Studio Code: IntelliSense, debugging, formatting, and more!", "categories": [ "Debuggers", "Formatters", @@ -32,8 +32,7 @@ "ahk2/server/dist/*", "ahk2/syntaxes/ahk2_common.json", "language/ahk.configuration.json", - "language/ahk.tmLanguage.json", - "language/ahk2.tmLanguage.json", + "language/*.tmLanguage.json", "language/autohotkey.svg", "language/autohotkey2.svg", "language/snippetsV1.json", @@ -49,15 +48,15 @@ "clean:dist": "del-cli dist", "clean:language": "del-cli language/*.tmLanguage.json", "clean:out": "del-cli out", - "compile-grammar": "js-yaml language/ahk.tmLanguage.yaml > language/ahk.tmLanguage.json && js-yaml language/ahk2.tmLanguage.yaml > language/ahk2.tmLanguage.json", + "compile-grammar": "js-yaml language/ahk.tmLanguage.yaml > language/ahk.tmLanguage.json && js-yaml language/ahk2.tmLanguage.yaml > language/ahk2.tmLanguage.json && js-yaml language/ahk2-output.tmLanguage.yaml > language/ahk2-output.tmLanguage.json", "precompile-ts": "npm run clean:out", "compile-ts": "tsc -b", - "eslint": "npm run eslint:files -- src && echo No ESLint problems", + "eslint": "npm run eslint:files -- src && cd ahk2 && npm run eslint", "eslint:files": "eslint --max-warnings=0", - "eslint:fix": "npm run eslint:files -- src --fix", - "format": "prettier --check .", - "format:fix": "prettier --write .", - "lint": "npm run eslint && npm run format && npm run sort-package-json", + "eslint:fix": "npm run eslint:files -- src --fix && cd ahk2 && npm run eslint:fix", + "format": "prettier --check . && cd ahk2 && npm run format", + "format:fix": "prettier --write . && cd ahk2 && npm run format:fix", + "lint": "npm run eslint && npm run sort-package-json", "package": "vsce package", "prepare": "husky install && git submodule update --init --recursive && cd ahk2 && npm install", "sort-package-json": "sort-package-json --check", @@ -68,7 +67,7 @@ "pretest-unit": "npm run compile-ts", "test-unit": "node ./out/src/test/runTest.js", "validate": "npm run lint && npm run test && npm run package", - "vscode:prepublish": "npm run build && echo Packaging..." + "vscode:prepublish": "npm run compile-grammar && npm run build && echo Packaging..." }, "contributes": { "breakpoints": [ @@ -111,6 +110,99 @@ "command": "ahk++.runSelection", "title": "Run Selection", "category": "AHK++" + }, + { + "enablement": "editorLangId == ahk2 && shellExecutionSupported", + "command": "ahk2.debug", + "title": "%ahk2.debug%", + "icon": "$(debug)", + "category": "ahk2" + }, + { + "enablement": "!isWeb", + "command": "ahk2.debug.attach", + "title": "%ahk2.debug.attach%", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2 && shellExecutionSupported", + "command": "ahk2.debug.params", + "title": "%ahk2.debug.params%", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2", + "command": "ahk2.diagnostic.full", + "title": "%ahk2.diagnostic.full%", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2", + "command": "ahk2.export.symbols", + "title": "%ahk2.export.symbols%", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2 && shellExecutionSupported", + "command": "ahk2.run", + "title": "%ahk2.run%", + "icon": "$(play)", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2 && !isWeb", + "command": "ahk2.selection.run", + "title": "%ahk2.selection.run%", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2 && !isWeb", + "command": "ahk2.stop", + "title": "%ahk2.stop%", + "icon": "$(stop)", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2 && shellExecutionSupported", + "command": "ahk2.compile", + "title": "%ahk2.compile%", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2", + "command": "ahk2.generate.comment", + "title": "%ahk2.generatecomment%", + "category": "ahk2" + }, + { + "enablement": "!isWeb", + "command": "ahk2.setinterpreter", + "title": "%ahk2.setinterpreter%", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2", + "command": "ahk2.updateversioninfo", + "title": "%ahk2.updateversioninfo%", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2 || editorLangId == ahk", + "command": "ahk2.switch", + "title": "Switch v1/v2", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2 && !isWeb", + "command": "ahk2.selectsyntaxes", + "title": "Select syntaxes", + "category": "ahk2" + }, + { + "enablement": "editorLangId == ahk2 && resourceScheme == file", + "command": "ahk2.setscriptdir", + "title": "%ahk2.setscriptdir%", + "category": "ahk2" } ], "configuration": { @@ -212,6 +304,273 @@ "type": "boolean", "default": true, "description": "Show the Debug button in the editor title menu." + }, + "AutoHotkey2.AutoLibInclude": { + "scope": "window", + "type": "string", + "enum": [ + "Disabled", + "Local", + "User and Standard", + "All" + ], + "default": "Disabled", + "description": "%ahk2.autolibinclude%" + }, + "AutoHotkey2.CommentTags": { + "scope": "window", + "type": "string", + "default": "^;;\\s*(?.+)", + "description": "%ahk2.commenttags%" + }, + "AutoHotkey2.CompilerCMD": { + "scope": "window", + "type": "string", + "default": "/compress 0 /base ${execPath}", + "markdownDescription": "%ahk2.compilercmd%" + }, + "AutoHotkey2.CompleteFunctionParens": { + "scope": "window", + "type": "boolean", + "default": false, + "markdownDescription": "%ahk2.completefunctionparens%" + }, + "AutoHotkey2.DebugConfiguration": { + "scope": "window", + "type": "object", + "default": { + "port": "9002-9100", + "useAnnounce": "detail", + "useAutoJumpToError": true, + "useDebugDirective": true, + "usePerfTips": true + }, + "description": "%ahk2.debugconfiguration%" + }, + "AutoHotkey2.Diagnostics.ClassNonDynamicMemberCheck": { + "scope": "window", + "type": "boolean", + "default": true, + "description": "%ahk2.diagnostics.class-non-dynamic-member-check%" + }, + "AutoHotkey2.Diagnostics.ParamsCheck": { + "scope": "window", + "type": "boolean", + "default": true, + "description": "%ahk2.diagnostics.paramscheck%" + }, + "AutoHotkey2.Warn.VarUnset": { + "scope": "window", + "type": "boolean", + "default": true, + "description": "%ahk2.warn.varunset%" + }, + "AutoHotkey2.Warn.LocalSameAsGlobal": { + "scope": "window", + "type": "boolean", + "default": false, + "description": "%ahk2.warn.localsameasglobal%" + }, + "AutoHotkey2.Warn.CallWithoutParentheses": { + "scope": "window", + "type": "string", + "enum": [ + "Off", + "Parentheses", + "On" + ], + "default": "Off", + "description": "%ahk2.warn.callwithoutparentheses%" + }, + "AutoHotkey2.ActionWhenV1IsDetected": { + "scope": "window", + "type": "string", + "default": "SwitchToV1", + "enum": [ + "Continue", + "Warn", + "StopParsing", + "SwitchToV1", + "SkipLine" + ], + "description": "%ahk2.actionwhenv1isdetected%" + }, + "AutoHotkey2.CompletionCommitCharacters": { + "scope": "window", + "type": "object", + "properties": { + "Class": { + "type": "string" + }, + "Function": { + "type": "string" + } + }, + "additionalProperties": { + "type": "string" + }, + "default": { + "Class": ".(", + "Function": "(" + }, + "markdownDescription": "%ahk2.completioncommitcharacters%" + }, + "AutoHotkey2.Files.Exclude": { + "scope": "window", + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "uniqueItems": true, + "description": "%ahk2.files.exclude%" + }, + "AutoHotkey2.Files.ScanMaxDepth": { + "scope": "window", + "type": "integer", + "default": 2, + "description": "%ahk2.files.scanmaxdepth%" + }, + "AutoHotkey2.FormatOptions": { + "scope": "window", + "type": "object", + "properties": { + "array_style": { + "type": "string", + "enum": [ + "collapse", + "expand", + "none" + ], + "default": "none" + }, + "brace_style": { + "type": "string", + "enum": [ + "One True Brace", + "Allman", + "One True Brace Variant" + ], + "enumDescriptions": [ + "if 1 {\n} else {\n}", + "if 1\n{\n}\nelse\n{\n}", + "if 1 {\n}\nelse {\n}" + ] + }, + "break_chained_methods": { + "type": "boolean", + "default": false + }, + "ignore_comment": { + "type": "boolean", + "default": false + }, + "indent_string": { + "type": "string", + "default": "\t" + }, + "indent_between_hotif_directive": { + "type": "boolean", + "default": false + }, + "keyword_start_with_uppercase": { + "type": "boolean", + "default": false + }, + "max_preserve_newlines": { + "type": "number", + "default": 2 + }, + "object_style": { + "type": "string", + "enum": [ + "collapse", + "expand", + "none" + ], + "default": "none" + }, + "preserve_newlines": { + "type": "boolean", + "default": true + }, + "space_before_conditional": { + "type": "boolean", + "default": true + }, + "space_after_double_colon": { + "type": "boolean", + "default": true + }, + "space_in_empty_paren": { + "type": "boolean", + "default": false + }, + "space_in_other": { + "type": "boolean", + "default": true + }, + "space_in_paren": { + "type": "boolean", + "default": false + }, + "switch_case_alignment": { + "type": "boolean", + "default": false + }, + "symbol_with_same_case": { + "type": "boolean", + "default": false + }, + "white_space_before_inline_comment": { + "type": "string" + }, + "wrap_line_length": { + "type": "number", + "default": 0 + } + }, + "additionalProperties": { + "type": "string" + }, + "default": {} + }, + "AutoHotkey2.InterpreterPath": { + "scope": "window", + "type": "string", + "default": "C:\\Program Files\\Autohotkey\\v2\\AutoHotkey.exe", + "markdownDescription": "%ahk2.interpreterpath%" + }, + "AutoHotkey2.SymbolFoldingFromOpenBrace": { + "scope": "window", + "type": "boolean", + "default": false, + "description": "%ahk2.symbolfoldingfromopenbrace%" + }, + "AutoHotkey2.WorkingDirs": { + "scope": "window", + "type": "array", + "default": [], + "items": { + "type": "string" + }, + "uniqueItems": true, + "description": "%ahk2.workingdirs%" + }, + "AutoHotkey2.Syntaxes": { + "scope": "window", + "type": "string", + "markdownDescription": "%ahk2.syntaxes%" + } + } + }, + "configurationDefaults": { + "[ahk2]": { + "editor.defaultFormatter": "mark-wiemer.vscode-autohotkey-plus-plus", + "editor.quickSuggestions": { + "other": true, + "comments": false, + "strings": true } } }, @@ -378,7 +737,18 @@ { "language": "ahk2", "scopeName": "source.ahk2", - "path": "./language/ahk2.tmLanguage.json" + "path": "./language/ahk2.tmLanguage.json", + "embeddedLanguages": { + "meta.embedded.ahk2": "ahk2" + }, + "unbalancedBracketScopes": [ + "keyword.keys.ahk2" + ] + }, + { + "language": "~ahk2-output", + "scopeName": "ahk2.output", + "path": "./language/ahk2-output.tmLanguage.json" } ], "keybindings": [ @@ -406,6 +776,36 @@ "command": "ahk++.runSelection", "key": "ctrl+f8", "when": "editorLangId == ahk || editorLangId == ahk2" + }, + { + "command": "ahk2.run", + "key": "ctrl+f5", + "when": "editorLangId == ahk2 && !isWeb && !editorHasSelection" + }, + { + "command": "ahk2.selection.run", + "key": "ctrl+f5", + "when": "editorLangId == ahk2 && !isWeb && editorHasSelection" + }, + { + "command": "ahk2.compile", + "key": "ctrl+shift+f5", + "when": "editorLangId == ahk2 && !isWeb" + }, + { + "command": "ahk2.debug", + "key": "f5", + "when": "editorLangId == ahk2 && !isWeb && !inDebugMode" + }, + { + "command": "ahk2.debug.params", + "key": "shift+f5", + "when": "editorLangId == ahk2 && !isWeb" + }, + { + "command": "ahk2.stop", + "key": "ctrl+f6", + "when": "editorLangId == ahk2 && !isWeb && ahk2:isRunning" } ], "languages": [ @@ -443,11 +843,17 @@ ".ah2", ".ahk2" ], - "configuration": "./language/ahk.configuration.json", + "configuration": "./language/ahk2.configuration.json", "icon": { "dark": "./language/autohotkey2.svg", "light": "./language/autohotkey2.svg" } + }, + { + "id": "~ahk2-output", + "extensions": [ + ".ahk2-output" + ] } ], "menus": { @@ -471,6 +877,51 @@ "command": "ahk++.runSelection", "when": "(editorLangId == ahk || editorLangId == ahk2) && editorHasSelection", "group": "navigation@-1" + }, + { + "when": "editorLangId == ahk2 && !isWeb", + "command": "ahk2.debug", + "group": "navigation@1" + }, + { + "when": "editorLangId == ahk2 && !isWeb", + "command": "ahk2.debug.attach", + "group": "navigation@2" + }, + { + "when": "editorLangId == ahk2 && !isWeb", + "command": "ahk2.debug.params", + "group": "navigation@2" + }, + { + "when": "editorLangId == ahk2 && !isWeb && editorHasSelection", + "command": "ahk2.selection.run", + "group": "navigation@0" + }, + { + "when": "editorLangId == ahk2 && !isWeb && !editorHasSelection", + "command": "ahk2.run", + "group": "navigation@0" + }, + { + "when": "editorLangId == ahk2 && !isWeb", + "command": "ahk2.compile", + "group": "navigation@2" + }, + { + "when": "editorLangId == ahk2 && !isWeb && ahk2:isRunning", + "command": "ahk2.stop", + "group": "navigation@0" + }, + { + "when": "editorLangId == ahk2", + "command": "ahk2.generate.comment", + "group": "navigation@2" + }, + { + "when": "editorLangId == ahk2", + "command": "ahk2.updateversioninfo", + "group": "navigation@2" } ], "editor/title": [ @@ -478,9 +929,34 @@ "command": "ahk++.debug", "when": "(editorLangId == ahk || editorLangId == ahk2) && config.ahk++.menu.showDebugButton", "group": "navigation@1" + }, + { + "command": "ahk2.run", + "group": "navigation@0", + "when": "resourceLangId == ahk2 && shellExecutionSupported" + }, + { + "command": "ahk2.stop", + "group": "navigation@0", + "when": "resourceLangId == ahk2 && ahk2:isRunning && shellExecutionSupported" + }, + { + "command": "ahk2.debug", + "group": "navigation@1", + "when": "resourceLangId == ahk2 && shellExecutionSupported" } ] }, + "semanticTokenScopes": [ + { + "language": "ahk2", + "scopes": { + "operator": [ + "keyword.operator.wordlike.ahk2" + ] + } + } + ], "snippets": [ { "language": "ahk", @@ -547,7 +1023,7 @@ "js-yaml": "^4.1.0", "lint-staged": "^14.0.1", "mocha": "^10.0.0", - "prettier": "2.6.1", + "prettier": "3.3.3", "sort-package-json": "^1.57.0", "source-map-support": "^0.5.19", "typescript": "~4.7.4", diff --git a/readme.md b/readme.md index cc0eb3fa..c1d106e1 100644 --- a/readme.md +++ b/readme.md @@ -9,9 +9,13 @@ AutoHotkey Plus Plus (AHK++) provides AutoHotkey language support for VS Code. F - quick help - ...and more! -## AHK v2 full support coming August 2024! +## Install + +Install from VS Code or install from [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=mark-wiemer.vscode-autohotkey-plus-plus). -AutoHotkey v2 support has been a [long-requested feature](https://github.com/mark-wiemer-org/ahkpp/issues/96), and v5.0.0 supports many key features. An August 2024 update will add IntelliSense, formatting, and debugger support to AHK++! +## AHK v2 full support in pre-release! + +AutoHotkey v2 support has been a [long-requested feature](https://github.com/mark-wiemer-org/ahkpp/issues/96), and v5.0.0 supports many key features. The latest [๐Ÿงช pre-release version](https://code.visualstudio.com/updates/v1_63#_pre-release-extensions), v5.1.0, adds full v2 support! Supported features include: @@ -19,48 +23,25 @@ Supported features include: - Full syntax highlighting for v2 scripts - "Open help" (Ctrl + F1) opens language-specific help (and includes your text selection!) - Unique icons for v1 (blue) and v2 (green) +- Rich IntelliSense support with snippets and hover text (๐Ÿงช pre-release only) +- Formatting files (๐Ÿงช pre-release only) + +For known issues, see [the changelog](./Changelog.md) -[Known limitations (issue #385)](https://github.com/mark-wiemer-org/ahkpp/issues/385): - -- No v2 formatting support -- No v2 snippets support -- "Run and debug" viewlet doesn't support v2 debugger - -Please [report any other issues](https://github.com/mark-wiemer-org/ahkpp/issues/new?assignees=mark-wiemer&labels=AHK+v2&projects=&template=v2.md&title=%5Bv2%5D+) ๐Ÿ› - -## Contents - -- [Why AutoHotkey Plus Plus?](#why-autohotkey-plus-plus) -- [Install](#install) -- [Commands](#commands) -- [Debug](#debug) -- [Language features](#language-features) - - [IntelliSense](#intellisense) - - [Function symbol](#function-symbol) - - [Go to definition](#go-to-definition) - - [Find references](#find-symbol-references) - - [Hover tip](#hover-tip) - - [Outline](#outline) - - [Folding](#folding) - - [Code format](#code-format) - - [Formatter directives](#formatter-directives) -- [Credits](#credits) -- [Links](#links) +Please [๐Ÿ› report any issues](https://github.com/mark-wiemer-org/ahkpp/issues/new/choose), it helps bring full v2 support to the release version faster ๐Ÿง‘โ€๐Ÿ’ป + +๐Ÿ’š Special thanks to [thqby](https://github.com/thqby), as this would not have been possible without thqby's open-source [AutoHotkey v2 Language Support](https://marketplace.visualstudio.com/items?itemName=thqby.vscode-autohotkey2-lsp)! ## Why AutoHotkey Plus Plus? AutoHotkey Plus Plus is one of many extensions that offer VS Code language support. So why should you use this one? -- **Supports both v1 and v2**: AHK++ now has support for AutoHotkey v2 (in preview), making it the only extension to support both major versions of AutoHotkey! +- **Supports both v1 and v2**: AHK++ supports both AHK v1 and v2, making it the only extension to support both major versions of AutoHotkey! - **Actively maintained**: Any issues encountered while using this extension can be reported and fixed. With other extensions, anything that's broken will stay broken forever. You can report any issues with AHK++ (and view all issues) through the [issue tracker](https://github.com/mark-wiemer/vscode-autohotkey-plus-plus/issues). - **IntelliSense**: Smart code completion, syntax highlighting, code navigation, and more. - **Debug support**: Run and debug AHK scripts from VS Code. - **New features**: Another benefit to active maintenance is that AHK++ can add new features as users request them. For example, quick help, formatter directives, and custom new file templates were all added based on user feedback! -## Install - -Install from VS Code or install from VS Code Marketplace: [Install AutoHotkey Plus Plus](https://marketplace.visualstudio.com/items?itemName=mark-wiemer.vscode-autohotkey-plus-plus). - ## Commands With AHK++, you can compile, debug, and run your scripts with keyboard shortcuts. You can also run a selection as a standalone script. diff --git a/src/extension.ts b/src/extension.ts index f53518ae..4a89a9ff 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -14,7 +14,7 @@ import { Global, ConfigKey } from './common/global'; import { AhkRenameProvider } from './providers/ahkRenameProvider'; import { SignatureProvider } from './providers/signatureProvider'; import { CompletionProvider } from './providers/completionProvider'; -// import { openHelp } from './service/helpService'; +import { openHelp } from './service/helpService'; import { initializeLanguageVersionService } from './service/languageVersionService'; import { activate as activateV2 } from '../ahk2/client/src/extension'; @@ -72,7 +72,7 @@ export function activate(context: vscode.ExtensionContext) { vscode.commands.registerCommand('ahk++.debug', () => RunnerService.startDebugger(), ), - // vscode.commands.registerCommand('ahk++.openHelp', openHelp), // leave this to the v2 extension for now + vscode.commands.registerCommand('ahk++.openHelp', openHelp), vscode.commands.registerCommand('ahk++.run', () => RunnerService.run()), vscode.commands.registerCommand('ahk++.runSelection', () => RunnerService.runSelection(),