CoffeeChaton / vscode-autohotkey-NekoHelp

autoHotkey-1.1 IntelliSense, format, linters, in vscode https://marketplace.visualstudio.com/items?itemName=cat1122.vscode-autohotkey-neko-help

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[feat] Directory whiteList Settings

CoffeeChaton opened this issue · comments

In addition to the current workspace, automatically scan the Folder,

For people who are not used to Multi-root Workspaces

  1. warn! this option is allow this extension try to the get file information by #include without workspaces. (privacy-statement)

  2. still respect "AhkNekoHelp.files.exclude" (blackList)

path Description
D:/myAutoHotkey/Lib any path
{ // settings.json
    "AhkNekoHelp.files.alwaysIncludeFolder": [
        "D:\\Q2", // folder path
        "D:/Q3", // use Linux-style separator Char is OK
    ] // string[] as path[]
}

I want to be precise, will autocomplete from files in these directories always or only if they are connected through #include?

I want to be precise, will autocomplete from files in these directories always or only if they are connected through #include?

  1. This option does not require the use of #include. It is inspired by AutoHotkey, where certain elements are automatically obtained without the need for #Include. (Refer to the AutoHotkey documentation.)
  2. To enable the parser's #include option, use AhkNekoHelp.files.tryParserIncludeOpt. (See Issue #16.)

@CoffeeChaton, what do I have to do to make this 100% work? Right now it doesn't work for all #include. What information should I provide?

You should ask at [#16], since this option has nothing to do with #include.

#21

"AhkNekoHelp.files.alwaysIncludeFolder"

This option is used to specify the starting folder for recursive scanning, excluding the current workspace. The following pseudocode illustrates this:

code at https://github.com/CoffeeChaton/vscode-autohotkey-NekoHelp/blob/main/src/tools/fsTools/getUriList.ts

#16

"AhkNekoHelp.file.tryParserIncludeOpt"

support

  1. Absolute path like #Include C:\My Documents\Scripts\Utility Subroutines.ahk
  2. %A_LineFile% style like #Include %A_LineFile%\..\ahk_test.ahk
  3. (beta) try to parser relative path, like #Include b.ahk

if ((/^%A_LineFile%/iu).test(path1)) {
// [v1.1.11+]: Use %A_LineFile%\.. to refer to the directory which contains the current file
// , even if it is not the main script file. For example, #Include %A_LineFile%\..\other.ahk.
return {
type: EInclude.A_LineFile,
mayPath: join(fsPath, `../${normalize(path1.replace(/^%A_LineFile%/iu, ''))}`),
warnMsg,
};
}
if ((/^%A_Desktop%/iu).test(path1)) {
return {
type: EInclude.A_Desktop,
mayPath: normalize(path1
.replace(/^%A_Desktop%/iu, `${os.homedir()}/Desktop`)),
warnMsg,
};
}
if (isAbsolute(path1)) {
return {
type: EInclude.Absolute,
mayPath: path1,
warnMsg,
};
}

if (
TryParserInclude === 'open'
|| (TryParserInclude === 'auto' && vscode.workspace.workspaceFolders !== undefined)
) {
const byRefLogList: { type: keyof TTryParserIncludeLog, msg: string }[] = [];
const cloneList: readonly TAhkFileData[] = [...FileListData];
for (const { AST, uri } of cloneList) {
FileListData.push(
// eslint-disable-next-line no-await-in-loop
...await pm.UpdateCacheAsyncCh(collectInclude(AST), uri.fsPath, byRefLogList),
);
}