exceedsystem / vscode-macros

This extension gives the macro features to your vscode.
https://marketplace.visualstudio.com/items?itemName=EXCEEDSYSTEM.vscode-macros
MIT License
38 stars 2 forks source link

My vscode is portable, Relative path required for "macroFilePath", Solved. #1

Closed davidWeiZhou closed 3 years ago

davidWeiZhou commented 3 years ago

My vscode is portable, Relative path required for "macroFilePath".

VSCode-win32-x64 |Code.exe |data □□□□|user-data □□□□□□□□|Macros □□□□□□□□□□□□|___macros.js

My settings.json: ... // javascript macros support "vscodemacros.runMacroAfterMacroFileSelection": true, "vscodemacros.macroFilePath": "./data/user-data/Macros/macros.js", // <== Relative path config improved ...

I modified the file of "extension.js", after line 9 add follow: const vscodeInstallPath = process.env.VSCODE_CWD + '/'; // <== added by me, after line 9

“process.env.VSCODE_CWD” is path to "Code.exe" directory.

In function getMacroModulePathConf(), find "const macroModPath = cfg.get(CFG_MACRO_MODULE_PATH);", modified to "const macroModPath = vscodeInstallPath + cfg.get(CFG_MACRO_MODULE_PATH);":

async function getMacroModulePathConf() { □□□□const cfg = getConfiguration(); □□□□const macroModPath = vscodeInstallPath + cfg.get(CFG_MACRO_MODULE_PATH); // <== modified by me, line 101

Test ok! It works well.

Nice!

exceedsystem commented 3 years ago

Hi @davidWeiZhou

Thank you for your valuable information. I have responded to your request in version 1.1.2.

davidWeiZhou commented 3 years ago

@exceedsystem Thanks very much! good job.