Check paths for FS existence before parsing them as paths with line numbers (#19057)

Closes https://github.com/zed-industries/zed/issues/18268

Release Notes:

- Fixed Zed not being open filenames with special combination of
brackets ([#18268](https://github.com/zed-industries/zed/issues/18268))
This commit is contained in:
Kirill Bulatov 2024-10-11 12:58:49 +03:00 committed by GitHub
parent 1691652948
commit ccaf3268f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 87 additions and 81 deletions

View file

@ -58,8 +58,9 @@ use workspace::{
AppState, WorkspaceSettings, WorkspaceStore,
};
use zed::{
app_menus, build_window_options, handle_cli_connection, handle_keymap_file_changes,
initialize_workspace, open_paths_with_positions, OpenListener, OpenRequest,
app_menus, build_window_options, derive_paths_with_position, handle_cli_connection,
handle_keymap_file_changes, initialize_workspace, open_paths_with_positions, OpenListener,
OpenRequest,
};
use crate::zed::inline_completion_registry;
@ -712,13 +713,11 @@ fn handle_open_request(
if let Some(connection_info) = request.ssh_connection {
cx.spawn(|mut cx| async move {
let paths_with_position =
derive_paths_with_position(app_state.fs.as_ref(), request.open_paths).await;
open_ssh_project(
connection_info,
request
.open_paths
.into_iter()
.map(|path| path.path)
.collect::<Vec<_>>(),
paths_with_position.into_iter().map(|p| p.path).collect(),
app_state,
workspace::OpenOptions::default(),
&mut cx,
@ -733,8 +732,10 @@ fn handle_open_request(
if !request.open_paths.is_empty() {
let app_state = app_state.clone();
task = Some(cx.spawn(|mut cx| async move {
let paths_with_position =
derive_paths_with_position(app_state.fs.as_ref(), request.open_paths).await;
let (_window, results) = open_paths_with_positions(
&request.open_paths,
&paths_with_position,
app_state,
workspace::OpenOptions::default(),
&mut cx,