mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2025-12-31 13:48:24 +03:00
Add ability for user to set scene file on right click in explorer (#182)
This commit is contained in:
17
package.json
17
package.json
@@ -74,6 +74,10 @@
|
||||
"light": "resources/light/icon_edit.svg",
|
||||
"dark": "resources/dark/icon_edit.svg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command": "godot-tool.set_scene_file",
|
||||
"title": "Set as Scene File"
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
@@ -105,7 +109,12 @@
|
||||
"default": "",
|
||||
"description": "The absolute path to the Godot editor executable"
|
||||
},
|
||||
"godot-tool.check_status": {
|
||||
"godot_tools.scene_file_config": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "The scene file to run"
|
||||
},
|
||||
"godot-tools.check_status": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "Check the gdscript language server connection status"
|
||||
@@ -274,6 +283,12 @@
|
||||
"when": "view == inspect-node && viewItem == editable_value",
|
||||
"group": "inline"
|
||||
}
|
||||
],
|
||||
"explorer/context": [
|
||||
{
|
||||
"command": "godot-tool.set_scene_file",
|
||||
"group": "2_workspace"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ServerController } from "./server_controller";
|
||||
const { Subject } = require("await-notify");
|
||||
import fs = require("fs");
|
||||
import { SceneTreeProvider } from "./scene_tree/scene_tree_provider";
|
||||
import { get_configuration } from "../utils";
|
||||
|
||||
interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
|
||||
address: string;
|
||||
@@ -233,8 +234,9 @@ export class GodotDebugSession extends LoggingDebugSession {
|
||||
args.port,
|
||||
args.launch_game_instance,
|
||||
args.launch_scene,
|
||||
args.scene_file,
|
||||
get_configuration("scene_file_config", "") || args.scene_file,
|
||||
]);
|
||||
|
||||
this.sendResponse(response);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ export class GodotTools {
|
||||
this.open_workspace_with_editor().catch(err=>vscode.window.showErrorMessage(err));
|
||||
});
|
||||
vscode.commands.registerCommand("godot-tool.check_status", this.check_client_status.bind(this));
|
||||
vscode.commands.registerCommand("godot-tool.set_scene_file", this.set_scene_file.bind(this));
|
||||
|
||||
this.connection_status.text = "$(sync) Initializing";
|
||||
this.connection_status.command = "godot-tool.check_status";
|
||||
@@ -62,6 +63,20 @@ export class GodotTools {
|
||||
});
|
||||
}
|
||||
|
||||
private set_scene_file(uri: vscode.Uri) {
|
||||
let right_clicked_scene_path = uri.fsPath
|
||||
let scene_config = get_configuration("scene_file_config");
|
||||
if (scene_config == right_clicked_scene_path) {
|
||||
scene_config = ""
|
||||
}
|
||||
else {
|
||||
scene_config = right_clicked_scene_path
|
||||
}
|
||||
|
||||
set_configuration("scene_file_config", scene_config);
|
||||
}
|
||||
|
||||
|
||||
private run_editor(params = "") {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user