diff --git a/.vscode/launch.json b/.vscode/launch.json index 28b0ef3d..ce0f86ce 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,32 +1,17 @@ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +// See `code --help` for launch args { "version": "0.2.0", "configurations": [ - { - "type": "ahk2", - "request": "launch", - "name": "AutoHotkey v2 Debugger", - "program": "${file}", - "stopOnEntry": true, - "runtime": "C:\\Program Files\\AutoHotkey\\v2\\AutoHotkey64.exe" - }, - { - "type": "ahk", - "request": "launch", - "name": "AutoHotkey v1 Debugger", - "program": "${file}", - "stopOnEntry": true, - "runtime": "C:\\Program Files\\AutoHotkey\\v1.1.37.01\\AutoHotkeyU64.exe" - }, { "name": "Launch Extension", "type": "extensionHost", "request": "launch", "args": ["--extensionDevelopmentPath=${workspaceRoot}"], - // "outFiles": ["${workspaceRoot}/out/**/*.js"], - "preLaunchTask": "build:dev" + "outFiles": ["${workspaceRoot}/out/**/*.js"], + "preLaunchTask": "npm: build:dev" }, { "name": "Test Extension", @@ -36,10 +21,10 @@ "args": [ "--disable-extensions", "--extensionDevelopmentPath=${workspaceFolder}", - "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" + "--extensionTestsPath=${workspaceFolder}/out/src/test/suite/index" ], "outFiles": ["${workspaceFolder}/out/test/**/*.js"], - "preLaunchTask": "npm: compile" + "preLaunchTask": "npm: compile-ts" } ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 45e9a144..00000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,34 +0,0 @@ -// https://code.visualstudio.com/docs/editor/tasks#vscode -{ - "version": "2.0.0", - "tasks": [ - { - "label": "build:dev", - "type": "npm", - "script": "build:dev", - "group": "build", - "isBackground": true, - "problemMatcher": [ - { - "pattern": [ - { - "regexp": ".", - "file": 1, - "location": 2, - "message": 3 - } - ], - "background": { - "activeOnStart": true, - "beginsPattern": { - "regexp": "build start" - }, - "endsPattern": { - "regexp": "build success" - } - } - } - ] - } - ] -} diff --git a/ahk2 b/ahk2 index c9589948..bfda9c14 160000 --- a/ahk2 +++ b/ahk2 @@ -1 +1 @@ -Subproject commit c9589948db2b7136722e6d425e186696f1a52c92 +Subproject commit bfda9c142c2f558834ccdaa60ef24567df297f54 diff --git a/build.mjs b/build.mjs index 9eb1239e..89432b32 100644 --- a/build.mjs +++ b/build.mjs @@ -9,22 +9,7 @@ build({ external: ['vscode'], format: 'cjs', platform: 'node', - // logLevel: 'error', metafile: true, - // sourceRoot: __dirname+"/src", minify: isProd, sourcemap: !isProd, - plugins: [ - { - name: 'build notice', - setup(build) { - build.onStart(() => { - console.log('Build start'); - }); - build.onEnd(() => { - console.log('Build success'); - }); - }, - }, - ], }); diff --git a/demos/manualTests/_readme.md b/demos/manualTests/_readme.md new file mode 100644 index 00000000..cbc659fd --- /dev/null +++ b/demos/manualTests/_readme.md @@ -0,0 +1,3 @@ +## AHK++ manual tests + +As a final sanity check, here are some manual tests to run. Be sure to packag the extension and install from VSIX before executing them. Each file describes itself. Feel free to open a discussion if you have any questions :) diff --git a/demos/manualTests/rename.ahk b/demos/manualTests/rename.ahk new file mode 100644 index 00000000..65fdb0b4 --- /dev/null +++ b/demos/manualTests/rename.ahk @@ -0,0 +1,5 @@ +#Requires AutoHotkey v2.0 + +; F2 renames variables +b := 1 +b := 2 \ No newline at end of file diff --git a/docs/Development.md b/docs/Development.md index 83fe93e0..27da8502 100644 --- a/docs/Development.md +++ b/docs/Development.md @@ -12,7 +12,11 @@ This document covers the development process, from writing code to publishing a ## Testing - Test all added commands -- If the readme was modified, confirm it appears as intended +- If the readme was modified, confirm it appears as intended in a non-GitHub viewer (Ctrl+Shift+V in VS Code is sufficient) + +### Launch Extension troubleshooting + +In the Run and Debug viewlet, the "Launch Extension" config is best for manual testing. [\_readme.md](../demos/manualTests/_readme.md) covers how those tests work. ## Starting a release diff --git a/package-lock.json b/package-lock.json index 7959679c..899a5131 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "vscode-tmgrammar-test": "^0.1.1" }, "engines": { - "vscode": "^1.50.0" + "vscode": "^1.90.0" } }, "node_modules/@azure/abort-controller": { diff --git a/package.json b/package.json index 1ce108a2..f86e7102 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,8 @@ "publisher": "mark-wiemer", "main": "./dist/extension", "files": [ + "ahk2/server/dist/*", + "ahk2/syntaxes/ahk2_common.json", "language/ahk.configuration.json", "language/ahk.tmLanguage.json", "language/ahk2.tmLanguage.json", @@ -41,13 +43,14 @@ "license.txt" ], "scripts": { - "build": "node build.mjs --mode=production", - "build:dev": "node build.mjs", + "build": "node build.mjs --mode=production && cd ahk2 && npm run build", + "build:dev": "node build.mjs && cd ahk2 && npm run build:dev", "clean:all": "npm run clean:dist && npm run clean:language && npm run clean:out", "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", + "precompile-ts": "npm run clean:out", "compile-ts": "tsc -b", "eslint": "npm run eslint:files -- src && echo No ESLint problems", "eslint:files": "eslint --max-warnings=0", @@ -62,7 +65,7 @@ "test": "npm run test-grammar && npm run test-unit", "pretest-grammar": "npm run compile-grammar", "test-grammar": "vscode-tmgrammar-snap language/samples/*.{ahk1,ahk2}", - "pretest-unit": "npm run clean:out && npm run compile-ts", + "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..." diff --git a/src/common/codeUtil.ts b/src/common/codeUtil.ts index c1876f49..90ad7f4c 100644 --- a/src/common/codeUtil.ts +++ b/src/common/codeUtil.ts @@ -68,6 +68,7 @@ export class CodeUtil { } /** Whether the current active text editor is for an AHK v1 file */ +// todo use LSP for all v2 functionality export const isV1 = (): boolean => vscode.window.activeTextEditor?.document.languageId === LanguageId.ahk1; diff --git a/src/extension.ts b/src/extension.ts index 42bc2bdf..f53518ae 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -14,14 +14,16 @@ 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'; export function activate(context: vscode.ExtensionContext) { + console.log('ahk++ activated'); (async () => { - Global.updateStatusBarItems('Indexing AutoHotkey Workspace...'); + Global.updateStatusBarItems('Indexing AutoHotkey workspace...'); await Parser.buildByPath(vscode.workspace.rootPath); - Global.updateStatusBarItems('Index Workspace Success!'); + Global.updateStatusBarItems('Indexed AutoHotkey workspace :)'); Global.hide(); })(); @@ -70,7 +72,7 @@ export function activate(context: vscode.ExtensionContext) { vscode.commands.registerCommand('ahk++.debug', () => RunnerService.startDebugger(), ), - vscode.commands.registerCommand('ahk++.openHelp', openHelp), + // vscode.commands.registerCommand('ahk++.openHelp', openHelp), // leave this to the v2 extension for now vscode.commands.registerCommand('ahk++.run', () => RunnerService.run()), vscode.commands.registerCommand('ahk++.runSelection', () => RunnerService.runSelection(), @@ -86,6 +88,8 @@ export function activate(context: vscode.ExtensionContext) { ), ); } + + activateV2(context); } class InlineDebugAdapterFactory