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

allow env variables in path #5

Closed rcx1 closed 2 years ago

rcx1 commented 2 years ago

At the moment it is impossible to have path like '%APPDATA%/myvsmacros/macros.js'

Possible solution:

    if (macroModPath.indexOf('%') >= 0) {
        for (let key in process.env) {
            if (macroModPath.indexOf('%') >= 0) {
                macroModPath = macroModPath.replace('%' + key + '%', process.env[key])
            } else {
                break;
            }
        }
    }
exceedsystem commented 2 years ago

Thank for the information. However, I know how to do it, but I'll have to consider other things.

exceedsystem commented 2 years ago

I am currently testing a version that supports Multi-root, Workspace(Folders), and environment variables. Please wait a little longer.

exceedsystem commented 2 years ago

@rcx1 Version 1.3.0 has been released, which allows environment variables to be used in macro path.