From 3645e431d32a1005d7d1d92d3704e1468fa50023 Mon Sep 17 00:00:00 2001 From: Geequlim Date: Wed, 9 Oct 2019 13:30:21 +0800 Subject: [PATCH] Add command to list godot native classes --- package.json | 4 ++++ src/lsp/NativeDocumentManager.ts | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/package.json b/package.json index be1f763..3315847 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/lsp/NativeDocumentManager.ts b/src/lsp/NativeDocumentManager.ts index 6069f33..1197c3f 100644 --- a/src/lsp/NativeDocumentManager.ts +++ b/src/lsp/NativeDocumentManager.ts @@ -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) {