L-I-V / MQL-Tools

42 stars 15 forks source link

Support ${workspaceFolder} variable in config #13

Closed supermomonga closed 1 year ago

supermomonga commented 1 year ago

Description

https://code.visualstudio.com/docs/editor/variables-reference

If we can use ${workspaceFolder} variable in settings.json, config value will be more portable, so we can commit a settings.json to git repository and share it between different environments.

{
    "mql_tools.Metaeditor.Include4Dir": "${workspaceFolder}/mql4/Include",
    "mql_tools.Metaeditor.Include5Dir": "${workspaceFolder}/mql5/Include",
    "mql_tools.Metaeditor.Metaeditor5Dir": "${workspaceFolder}/terminal/metaeditor64.exe",
    "mql_tools.Metaeditor.Metaeditor4Dir": "${workspaceFolder}/terminal/metaeditor.exe",
}

Implimentation

Unfortunately, I think VSCode doesn't expose variable resolver for now.

https://github.com/microsoft/vscode/issues/46471

For example, MS's official vscode-js-debug extension seems have their own resolver code. https://github.com/microsoft/vscode-js-debug/blob/059d70420acc901a9fda413b42a154783dccf208/src/configuration.ts#L1086-L1099

so vscode-js-debug accepts following configs.

{
    "debug.javascript.autoAttachSmartPattern": [
        "${workspaceFolder}/**",
        "!**/node_modules/**",
        "**/$KNOWN_TOOLS$/**"
    ]
}
L-I-V commented 1 year ago

In the following releases, I will add the ability to use '${workspaceFolder}'.