VSCode extensions location variable

前端 未结 1 1158
暗喜
暗喜 2020-12-02 03:10

In an extension I am writing, I want to redefine an existing setting in the workspace to point at a script I am packaging with the extension. On a mac this script lives in <

相关标签:
1条回答
  • 2020-12-02 03:31

    You can get that information by the asAbsolutePath() method of the ExtensionContext.
    This method gets you the absolute path of a resource for a given relative path (regarding your project root).

    Therefore I suggest you to change your code to the following:

    export async function activate(context: vscode.ExtensionContext) {
        const execLocation = context.asAbsolutePath("script");
        console.log("Absolute exec location: " + execLocation);
    
    0 讨论(0)
提交回复
热议问题