Add command to list godot native classes

This commit is contained in:
Geequlim
2019-10-09 13:30:21 +08:00
parent e2febb81b1
commit 3645e431d3
2 changed files with 20 additions and 0 deletions

View File

@@ -34,6 +34,10 @@
{
"command": "godot-tool.run_project",
"title": "Godot Tools: Run workspace as Godot project"
},
{
"command": "godot-tool.list_native_classes",
"title": "Godot Tools: List native classes of godot"
}
],
"configuration": {

View File

@@ -14,6 +14,7 @@ marked.setOptions({
const enum WebViewMessageType {
INSPECT_NATIVE_SYMBOL = 'INSPECT_NATIVE_SYMBOL',
};
const LIST_NATIVE_CLASS_COMMAND = 'godot-tool.list_native_classes';
export default class NativeDocumentManager extends EventEmitter {
@@ -39,6 +40,21 @@ export default class NativeDocumentManager extends EventEmitter {
}
}
});
vscode.commands.registerCommand(LIST_NATIVE_CLASS_COMMAND, this.list_native_classes.bind(this));
}
private async list_native_classes() {
let classname = await vscode.window.showQuickPick(
Object.keys(this.native_classes).sort(),
{
placeHolder: 'Type godot class name here',
canPickMany: false
}
);
if (classname) {
this.inspect_native_symbol({native_class: classname, symbol_name: classname});
}
}
private inspect_native_symbol(params: NativeSymbolInspectParams) {