I am writing a plugin for VS Code and I need to know the path of the file which is calling the extension, either if it was called from the editor context menu or explorer context menu or the user simply typed the extension command.
function activate(context){
// get full path of the file somehow
}
Thanks in advance!
If you open the folder, then you can get the workspace
variable.
let folderName = vscode.workspace.name; // get the open folder name
let folderPath = vscode.workspace.rootPath; // get the open folder path
More detail can get from VS Code API