Skip to content

Commit

Permalink
Open config files from commands
Browse files Browse the repository at this point in the history
  • Loading branch information
focus-editor committed Apr 26, 2023
1 parent fef6c54 commit 2901c62
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
===========================

- Project commands:
- Open projects folder
- Open global config
- Open project config
+ Open projects folder
+ Open global config
+ Open project config
- Switch project

- Line wrap:
Expand Down
2 changes: 1 addition & 1 deletion src/keymap.jai
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Key_Combo :: struct {
ACTIONS_COMMON :: string.[
"do_nothing", // to disable key combinations

"switch_project",
"open_project",
"open_projects_directory",
"open_global_config",
"open_project_config",
Expand Down
14 changes: 9 additions & 5 deletions src/widgets/commands.jai
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ commands_execute_selected :: () {
if command.action == {
case .do_nothing; return;

case .open_projects_directory;
platform_open_in_explorer(projects_dir);
case .open_global_config;
case .open_projects_directory; platform_open_in_explorer(projects_dir);
case .open_global_config; editors_open_file(global_config_path);
case .open_project_config;
case .switch_project;
if project_config_path {
editors_open_file(project_config_path);
} else {
add_user_warning("No project is active. Please open a project first.", dismiss_in_seconds = 5);
}
case .open_project;
case;
dummy_event: Input.Event; // TODO: refactor so that this event is not needed
// (need to put the search bar into its own widget for this)
Expand Down Expand Up @@ -150,7 +154,7 @@ commands := #run Command.[
.{ .show_open_file_dialog_in_navigate_mode, "Navigate To File", 0, false },
.{ .show_open_file_dialog_in_navigate_mode_from_root, "Navigate To File From Root", 0, false },

.{ .switch_project, "Switch Project", 0, false },
.{ .open_project, "Open Project", 0, false },
.{ .open_projects_directory, "Open Projects Directory", 0, false },
.{ .open_global_config, "Open Global Config", 0, false },
.{ .open_project_config, "Open Project Config", 0, false },
Expand Down

0 comments on commit 2901c62

Please sign in to comment.