Skip to content

Commit

Permalink
Fixup v2 including and excluding without extension restart
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-wiemer committed Oct 16, 2024
1 parent c48a801 commit fe7bdc8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ahk2
Submodule ahk2 updated from f75b53 to d5a3f8
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion e2e/main.ahk2
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -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](<https://en.wikipedia.org/wiki/Glob_(programming)>) for excluding files and folders. Applies even when files are opened. Changes take effect after restart.",
"ahk++.config.exclude": "[Glob patterns](<https://en.wikipedia.org/wiki/Glob_(programming)>) 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.",
Expand Down
1 change: 1 addition & 0 deletions src/common/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
23 changes: 16 additions & 7 deletions src/test/config.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ShowOutput>(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);
Expand All @@ -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<string[]>(ConfigKey.exclude, exclude);
if (version === 1)
await updateConfig<string[]>(ConfigKey.exclude, exclude);
const filePath = resolve(rootPath, `./e2e/main.ahk${version}`);
const doc = await getDocument(filePath);
const editor = await showDocument(doc);
Expand Down

0 comments on commit fe7bdc8

Please sign in to comment.