-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension.js
More file actions
27 lines (21 loc) · 852 Bytes
/
extension.js
File metadata and controls
27 lines (21 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const vscode = require('vscode');
const copy_paste = require('copy-paste');
const child_process = require('child_process');
function activate(context) {
let disposable = vscode.commands.registerCommand('extension.copyPyPath', function () {
var pyexec = vscode.workspace.getConfiguration().python.pythonPath
var filename = vscode.window.activeTextEditor.document.fileName;
var py_proc = child_process.spawnSync(pyexec, [__dirname + '/get_path.py', filename]);
var pypath = py_proc.stdout.toString().trim();
if(pypath){
copy_paste.copy(pypath);
} else {
vscode.window.showInformationMessage('Python path was not found');
}
});
context.subscriptions.push(disposable);
}
exports.activate = activate;
function deactivate() {
}
exports.deactivate = deactivate;