diff --git a/ahk2 b/ahk2 index 234ebd1c..c05e25ed 160000 --- a/ahk2 +++ b/ahk2 @@ -1 +1 @@ -Subproject commit 234ebd1c804cd83de7462a7b6fe46015ffcb984c +Subproject commit c05e25ede71fb57a15c9e1fa18606068a2a8a88e diff --git a/changelog.md b/changelog.md index 3a897cf1..948027d4 100644 --- a/changelog.md +++ b/changelog.md @@ -15,9 +15,10 @@ ### Fixes +- Fix v1 formatter removing extra spaces in strings ([#411](https://github.com/mark-wiemer-org/ahkpp/issues/411)) +- Fix v2 formatter moving closing brackets/braces when `arrayStyle` or `objectStyle` were set to "none" (the default) ([#499](https://github.com/mark-wiemer-org/ahkpp/issues/499)) - Fixup output channel names: "AHK++ (v1)" and "AHK++ (v2)" instead of "AHK" and "AHK++" respectively -- Fix duplicate output channels -- Fix formatter removing extra spaces in v1 strings ([#411](https://github.com/mark-wiemer-org/ahkpp/issues/411)) +- Fix duplicate output channels (the "AHK" channel used to be created twice) ### Other diff --git a/package-lock.json b/package-lock.json index f5ff6d1b..fdc2851b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,6 @@ "devDependencies": { "@eslint/js": "^9.9.0", "@types/eslint__js": "^8.42.3", - "@types/fs-extra": "^9.0.7", "@types/glob": "^7.1.3", "@types/mocha": "^10.0.8", "@types/node": "^20.16.0", @@ -34,7 +33,6 @@ "del-cli": "^6.0.0", "esbuild": "0.24.0", "eslint": "^9.9.0", - "fs-extra": "^9.1.0", "glob": "^7.1.6", "js-yaml": "^4.1.0", "mocha": "^10.0.0", @@ -1127,15 +1125,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/fs-extra": { - "version": "9.0.13", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", - "integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", @@ -1653,9 +1642,9 @@ } }, "node_modules/@vscode/vsce": { - "version": "3.1.1", - "resolved": "https://registry.npmmirror.com/@vscode/vsce/-/vsce-3.1.1.tgz", - "integrity": "sha512-N62Ca9ElRPLUUzf7l9CeEBlLrYzFPRQq7huKk4pVW+LjIOSXfFIPudixn5QvZcz+yXDOh15IopI3K2o3y9666Q==", + "version": "3.2.0", + "resolved": "https://registry.npmmirror.com/@vscode/vsce/-/vsce-3.2.0.tgz", + "integrity": "sha512-c/AId5Lp50HTszCBDfXfD/Go2djm6qO/WfedP2Y3BpRP+V+ttr8T0mTvZ8WEyTiBp2EfrYnzYUCx0ocB9mHy4Q==", "dev": true, "license": "MIT", "dependencies": { @@ -2111,15 +2100,6 @@ "dev": true, "license": "MIT" }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/azure-devops-node-api": { "version": "12.5.0", "resolved": "https://registry.npmmirror.com/azure-devops-node-api/-/azure-devops-node-api-12.5.0.tgz", @@ -3448,21 +3428,6 @@ "dev": true, "optional": true }, - "node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -4104,18 +4069,6 @@ "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", "dev": true }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/jsonwebtoken": { "version": "9.0.2", "resolved": "https://registry.npmmirror.com/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", @@ -5831,15 +5784,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true, - "engines": { - "node": ">= 10.0.0" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmmirror.com/uri-js/-/uri-js-4.4.1.tgz", @@ -6915,15 +6859,6 @@ "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, - "@types/fs-extra": { - "version": "9.0.13", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", - "integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", @@ -7268,9 +7203,9 @@ } }, "@vscode/vsce": { - "version": "3.1.1", - "resolved": "https://registry.npmmirror.com/@vscode/vsce/-/vsce-3.1.1.tgz", - "integrity": "sha512-N62Ca9ElRPLUUzf7l9CeEBlLrYzFPRQq7huKk4pVW+LjIOSXfFIPudixn5QvZcz+yXDOh15IopI3K2o3y9666Q==", + "version": "3.2.0", + "resolved": "https://registry.npmmirror.com/@vscode/vsce/-/vsce-3.2.0.tgz", + "integrity": "sha512-c/AId5Lp50HTszCBDfXfD/Go2djm6qO/WfedP2Y3BpRP+V+ttr8T0mTvZ8WEyTiBp2EfrYnzYUCx0ocB9mHy4Q==", "dev": true, "requires": { "@azure/identity": "^4.1.0", @@ -7579,12 +7514,6 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dev": true }, - "at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true - }, "azure-devops-node-api": { "version": "12.5.0", "resolved": "https://registry.npmmirror.com/azure-devops-node-api/-/azure-devops-node-api-12.5.0.tgz", @@ -8513,18 +8442,6 @@ "dev": true, "optional": true }, - "fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, - "requires": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -8963,16 +8880,6 @@ "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", "dev": true }, - "jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, "jsonwebtoken": { "version": "9.0.2", "resolved": "https://registry.npmmirror.com/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", @@ -10222,12 +10129,6 @@ "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", "dev": true }, - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true - }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmmirror.com/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 3b2fdc6d..dca5ca80 100644 --- a/package.json +++ b/package.json @@ -71,14 +71,15 @@ "sort-package-json": "sort-package-json --check", "sort-package-json:fix": "sort-package-json", "test": "npm run test:grammar && npm run test:unit && npm run test:e2e", - "test:ci": "npm run test:grammar && npm run test:e2e:ci", + "test:ci": "npm run test:grammar && npm run test:unit:ci && npm run test:e2e:ci", "pretest:e2e": "npm run build && npm run compile:ts", "test:e2e": "vscode-test", - "test:e2e:ci": "npm run test:e2e -- -i --fgrep @ignoreCI", + "test:e2e:ci": "npm run test:e2e -- -i --fgrep @ignoreCI --forbid-only", "pretest:grammar": "npm run compile:grammar", "test:grammar": "vscode-tmgrammar-snap language/samples/*.{ahk1,ahk2}", "pretest:unit": "npm run compile:ts", "test:unit": "mocha", + "test:unit:ci": "npm run test:unit -- --forbid-only", "validate": "npm run lint && npm run test && npm run package", "validate:ci": "npm run lint && npm run test:ci && npm run package", "validate:deep": "cd ahk2 && npm run validate && cd .. && npm run validate", @@ -1158,7 +1159,6 @@ "devDependencies": { "@eslint/js": "^9.9.0", "@types/eslint__js": "^8.42.3", - "@types/fs-extra": "^9.0.7", "@types/glob": "^7.1.3", "@types/mocha": "^10.0.8", "@types/node": "^20.16.0", @@ -1171,7 +1171,6 @@ "del-cli": "^6.0.0", "esbuild": "0.24.0", "eslint": "^9.9.0", - "fs-extra": "^9.1.0", "glob": "^7.1.6", "js-yaml": "^4.1.0", "mocha": "^10.0.0", diff --git a/src/providers/formattingProvider.e2e.ts b/src/providers/formattingProvider.e2e.ts index d4ca2d8b..ca806759 100644 --- a/src/providers/formattingProvider.e2e.ts +++ b/src/providers/formattingProvider.e2e.ts @@ -1,6 +1,6 @@ import { getDocument, showDocument } from '../test/utils'; import * as assert from 'assert'; -import * as fs from 'fs-extra'; +import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; import { FormatProvider } from './formattingProvider'; diff --git a/src/providers/formattingProvider.utils.test.ts b/src/providers/formattingProvider.utils.test.ts index c21146f1..6e25f10d 100644 --- a/src/providers/formattingProvider.utils.test.ts +++ b/src/providers/formattingProvider.utils.test.ts @@ -19,7 +19,7 @@ import { removeEmptyLines, trimExtraSpaces, } from './formattingProvider.utils'; -import * as fs from 'fs-extra'; +import * as fs from 'fs'; import * as path from 'path'; import { FormatOptions } from './formattingProvider.types'; @@ -1049,7 +1049,7 @@ interface FormatTest { options?: Partial; } -suite.only('internalFormat', () => { +suite('internalFormat', () => { // Currently in `out` folder, need to get back to main `src` folder const filesParentPath = path.join( __dirname, // ./out/src/providers @@ -1064,8 +1064,8 @@ suite.only('internalFormat', () => { const inFilenameSuffix = '.in.ahk'; const outFilenameSuffix = '.out.ahk'; - const fileToString = (path: string): string => - fs.readFileSync(path).toString(); + const fileToString = (filePath: string): string => + fs.readFileSync(filePath).toString(); /** Default formatting options, meant to match default extension settings */ const defaultOptions = { diff --git a/src/test/config.e2e.ts b/src/test/config.e2e.ts index ba63a083..eb9d0136 100644 --- a/src/test/config.e2e.ts +++ b/src/test/config.e2e.ts @@ -85,11 +85,13 @@ suite('exclude', () => { tests.forEach(([name, version, exclude, expected]) => { test(name, async () => { - if (version === 1) + if (version === 1) { await updateConfig(ConfigKey.exclude, exclude); + } const filePath = resolve(rootPath, `./e2e/main.ahk${version}`); const doc = await getDocument(filePath); const editor = await showDocument(doc); + await sleep(1_000); // todo only these tests are extra flaky await addAndSelectSnippet(editor, snippetText); const labels = await getCompletionSuggestionLabels(editor); @@ -99,14 +101,14 @@ suite('exclude', () => { }); }); -suite.only('v2.general.librarySuggestions', () => { +suite('v2.general.librarySuggestions', () => { let editor: vscode.TextEditor; before(async () => { await updateConfig(ConfigKey.exclude, []); const filePath = resolve(rootPath, './e2e/main.ahk2'); const doc = await getDocument(filePath); editor = await showDocument(doc); - await sleep(1000); + await sleep(1_000); }); const tests: [name: string, libType: LibIncludeType, expected: boolean][] = diff --git a/src/test/utils.ts b/src/test/utils.ts index bcce5686..60cd54b3 100644 --- a/src/test/utils.ts +++ b/src/test/utils.ts @@ -47,7 +47,7 @@ export const updateConfig = async ( await vscode.workspace .getConfiguration(configPrefix) .update(section, value, false); - await sleep(1500); // todo tests are flaky even at 1_000ms + await sleep(1_500); // todo tests are flaky even at 1_000ms }; /**