diff --git a/ahk2 b/ahk2 index f75b53eb..d5a3f83e 160000 --- a/ahk2 +++ b/ahk2 @@ -1 +1 @@ -Subproject commit f75b53eb8b7b14e8bfd4a6ad299dd19caa8526c1 +Subproject commit d5a3f83e88d624eb2cd0ec06cc99b36e8855cd8a diff --git a/changelog.md b/changelog.md index 2231efdf..acfdb7e6 100644 --- a/changelog.md +++ b/changelog.md @@ -3,10 +3,12 @@ ## 6.3.0 - unreleased 🕳️ - Add exclude setting ([#488](https://github.com/mark-wiemer-org/ahkpp/issues/488)) + - Excluded files are not included in IntelliSense completion suggestions, even when they're added via `#include` - Changed `v2.exclude` setting to `exclude` - One setting works for both v1 and v2 + - Changes to this setting take effect immediately, no need to restart your IDE (different than thqby's extension) - v2 will exclude excluded files from suggestions even if they're opened in the IDE (different than thqby's extension) - - v1 no longer automatically ignores files with `out`, `target`, and `node_modules` in their name + - v1 no longer automatically ignores files with `out`, `target`, or `node_modules` in their name - Fixup output channel names: "AHK++ (v1)" and "AHK++ (v2)" instead of "AHK" and "AHK++" respectively - Fix duplicate output channels diff --git a/e2e/main.ahk2 b/e2e/main.ahk2 index 83791603..12f90e0d 100644 --- a/e2e/main.ahk2 +++ b/e2e/main.ahk2 @@ -1,5 +1,5 @@ #Requires AutoHotkey v2.0 ; Exclude pattern: excluded.ahk -;* Should not suggest "my excluded func" in completion +;* Should not suggest "MyExcludedFunc" in completion MyExclu \ No newline at end of file diff --git a/package.nls.json b/package.nls.json index 5d05a0c1..eb910c98 100644 --- a/package.nls.json +++ b/package.nls.json @@ -22,7 +22,7 @@ "ahk++.config.v2.diagnostics.classNonDynamicMemberCheck": "Check whether non-dynamic members of a class exist", "ahk++.config.v2.diagnostics.paramsCheck": "Check that the function call has the correct number of arguments", "ahk++.config.v2.file.interpreterPath": "Path to the `AutoHotkey.exe` executable file for AHK v2.", - "ahk++.config.exclude": "[Glob patterns]() for excluding files and folders. Applies even when files are opened. Changes take effect after restart.", + "ahk++.config.exclude": "[Glob patterns]() for excluding files and folders from completion suggestions. Applies even when files are opened.", "ahk++.config.v2.file.maxScanDepth": "Depth of folders to scan for IntelliSense. Negative values mean infinite depth.", "ahk++.config.v2.librarySuggestions": "Which libraries to suggest functions from, if any. In case of issues, restart your IDE.", "ahk++.config.v2.symbolFoldingFromOpenBrace": "Fold parameter lists separately from definitions.", diff --git a/src/common/global.ts b/src/common/global.ts index b400f753..9f16b32a 100644 --- a/src/common/global.ts +++ b/src/common/global.ts @@ -41,6 +41,7 @@ export enum ConfigKey { compileIcon = 'compiler.compileIcon', compilerPath = 'compiler.compilerPath', exclude = 'exclude', + general = 'general', helpPathV1 = 'v1.file.helpPath', helpPathV2 = 'v2.file.helpPath', indentCodeAfterIfDirective = 'v1.formatter.indentCodeAfterIfDirective', diff --git a/src/test/config.e2e.ts b/src/test/config.e2e.ts index 338366bb..4894e997 100644 --- a/src/test/config.e2e.ts +++ b/src/test/config.e2e.ts @@ -20,7 +20,9 @@ const samplesParentPath = path.join(rootPath, 'src/test/samples'); // CI does not have AHK installed suite('general.showOutput @ignoreCI', () => { const before = async (show: ShowOutput) => { - await updateConfig(ConfigKey.showOutput, show); + await updateConfig<{ showOutput: ShowOutput }>(ConfigKey.general, { + showOutput: show, + }); const filePath = path.join(samplesParentPath, 'ahk2.ahk2'); const doc = await getDocument(filePath); await showDocument(doc); @@ -45,24 +47,31 @@ suite('general.showOutput @ignoreCI', () => { }); }); -suite.only('exclude', () => { +suite('exclude', () => { + /** + * These tests run in a specific order to update the config correctly + * Config does not update on v2 for speed + */ const tests: [ name: string, version: 1 | 2, exclude: string[], expected: boolean, ][] = [ - ['no exclusions', 1, [], true], - ['no exclusions', 2, [], true], - ['exclusions', 1, ['excluded.ahk'], false], - // ['exclusions', 2, ['excluded.ahk'], false], // todo support v2 without reloading + ['v1 no exclusions', 1, [], true], + ['v2 no exclusions', 2, [], true], + ['v1 exclusions', 1, ['excluded.ahk'], false], + ['v2 exclusions', 2, ['excluded.ahk'], false], + ['back to v1 no exclusions', 1, [], true], + ['back to v2 no exclusions', 2, [], true], ]; tests.forEach(([name, version, exclude, expected]) => { test(name, async () => { const snippetText = 'MyExclu'; const funcName = 'MyExcludedFunc'; - await updateConfig(ConfigKey.exclude, exclude); + 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);