-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcommandPanel.js
More file actions
34 lines (28 loc) · 840 Bytes
/
commandPanel.js
File metadata and controls
34 lines (28 loc) · 840 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
28
29
30
31
32
33
34
const hx = require('hbuilderx');
let packageFile = require('./package.json');
let commands = packageFile.contributes.commands;
/**
* @description 命令面板
* @datetime 2020-10-30 10:16:00
*/
function showCommandPanel(param) {
try{
count('CommandPanel').catch( error=> {});
}catch(e){};
let tmp = [];
for (let s of commands) {
if (s.command != 'api.CommandPanel') {
tmp.push(s);
}
};
let data = JSON.parse(JSON.stringify(tmp).replace(/title/g,"label"));
const pickResult = hx.window.showQuickPick(data, {
placeHolder: '请选择要执行的操作'
});
pickResult.then(function(result) {
if (!result) { return; };
let cmd = result.command;
hx.commands.executeCommand(cmd, param);
});
};
module.exports = showCommandPanel;