Reputation: 109
There is the steps.
Command handler
vscode.commands.registerCommand('extension.myExtension', function (event) {
// event is undefined.
// how to do in here?
})
Upvotes: 1
Views: 2013
Reputation: 362
Here's how you can do it
vscode.commands.registerCommand('extension.myExtension', function (event) {
const activeEditor = vscode.window.activeTextEditor;
if(activeEditor){
//For Getting File Path
let filePath = activeEditor.document.uri.path;
}
})
Upvotes: 1