Finding VSCode extension extension id
Answer a question
I am currently writing a vscode extension where I require to bundle some files with the extension and on some command, I need to deploy those files at some destination directory (like building a scaffold). For this purpose, I was looking into using these two functions:
const extensionPath = vscode.extensions.getExtension('extension.id').extensionUri.path;
const destinationPath = vscode.workspace.workspaceFolders[0].uri.path;
However, I had trouble finding the extension.id. If I use vscode.extensions.all to enumerate all the extensions, I see undefined_publisher.<name>. I believe this is because I have not published my extension yet, but in that case I guess the undefined_publisher part might change.
Is there any way I can locate my extension without using the publisher name?
Answers
The ExtensionContext object has path and uri properties.
It is the context from your activate(context) function.
See https://code.visualstudio.com/api/references/vscode-api#ExtensionContext
更多推荐
所有评论(0)