mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2026-01-04 10:09:58 +03:00
Add ability for user to set scene file on right click in explorer (#182)
This commit is contained in:
@@ -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