Skip to content

Commit

Permalink
some style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhou121 committed Aug 14, 2024
1 parent 1f22a05 commit 9ca4a99
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
14 changes: 10 additions & 4 deletions lapce-app/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,18 @@ pub enum LapceWorkbenchCommand {
#[strum(message = "Show Call Hierarchy")]
ShowCallHierarchy,

#[strum(serialize = "reveal_in_file_tree")]
#[strum(message = "Reveal in File Tree")]
RevealInFileTree,
#[strum(serialize = "reveal_in_panel")]
#[strum(message = "Reveal in Panel")]
RevealInPanel,

#[cfg(not(target_os = "macos"))]
#[strum(serialize = "reveal_in_file_explorer")]
#[strum(message = "Reveal in File Explorer")]
#[strum(message = "Reveal in System File Explorer")]
RevealInFileExplorer,

#[cfg(target_os = "macos")]
#[strum(serialize = "reveal_in_file_explorer")]
#[strum(message = "Reveal in Finder")]
RevealInFileExplorer,

#[strum(serialize = "run_in_terminal")]
Expand Down
14 changes: 6 additions & 8 deletions lapce-app/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2736,23 +2736,21 @@ impl EditorData {
Some(CommandKind::Workbench(
LapceWorkbenchCommand::ShowCallHierarchy,
)),
None,
Some(CommandKind::Focus(FocusCommand::Rename)),
Some(CommandKind::Workbench(LapceWorkbenchCommand::RunInTerminal)),
None,
Some(CommandKind::Workbench(LapceWorkbenchCommand::RevealInPanel)),
Some(CommandKind::Workbench(
LapceWorkbenchCommand::RevealInFileExplorer,
)),
None,
Some(CommandKind::Edit(EditCommand::ClipboardCut)),
Some(CommandKind::Edit(EditCommand::ClipboardCopy)),
Some(CommandKind::Edit(EditCommand::ClipboardPaste)),
None,
Some(CommandKind::Workbench(
LapceWorkbenchCommand::RevealInFileTree,
)),
Some(CommandKind::Workbench(
LapceWorkbenchCommand::RevealInFileExplorer,
)),
Some(CommandKind::Workbench(
LapceWorkbenchCommand::PaletteCommand,
)),
Some(CommandKind::Workbench(LapceWorkbenchCommand::RunInTerminal)),
]
} else {
vec![
Expand Down
30 changes: 16 additions & 14 deletions lapce-app/src/file_explorer/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,21 +546,23 @@ impl FileExplorerData {
// TODO: there are situations where we can open the file explorer to remote files
if !common.workspace.kind.is_remote() {
let path = path_a.clone();
menu = menu.entry(MenuItem::new("Reveal in file explorer").action(
move || {
let path = path.parent().unwrap_or(&path);
if !path.exists() {
return;
}
#[cfg(not(target_os = "macos"))]
let title = "Reveal in system file explorer";
#[cfg(target_os = "macos")]
let title = "Reveal in Finder";
menu = menu.entry(MenuItem::new(title).action(move || {
let path = path.parent().unwrap_or(&path);
if !path.exists() {
return;
}

if let Err(err) = open::that(path) {
tracing::error!(
"Failed to reveal file in system file explorer: {}",
err
);
}
},
));
if let Err(err) = open::that(path) {
tracing::error!(
"Failed to reveal file in system file explorer: {}",
err
);
}
}));
}

if !is_workspace {
Expand Down
2 changes: 1 addition & 1 deletion lapce-app/src/window_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ impl WindowTabData {
Quit => {
floem::quit_app();
}
RevealInFileTree => {
RevealInPanel => {
if let Some(editor_data) =
self.main_split.active_editor.get_untracked()
{
Expand Down

0 comments on commit 9ca4a99

Please sign in to comment.