Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't reopen last workspace when opening a new file/directory from cli #9592

Closed
1 task done
brianm opened this issue Mar 20, 2024 · 9 comments
Closed
1 task done

Don't reopen last workspace when opening a new file/directory from cli #9592

brianm opened this issue Mar 20, 2024 · 9 comments
Labels
cli Command-line interface feedback enhancement [core label] workspace Feedback for workspace management, layout, interactions, etc

Comments

@brianm
Copy link

brianm commented Mar 20, 2024

Check for existing issues

  • Completed

Describe the feature

When I launch zed from the command line, a la zed .zshrc, and it launches zed it should just open the file/directory specified on the cli and NOT open the previously open project/workspace/directory.

If I do not specify a file/directory to open then maintaining current behavior (open previous) seems reasonable -- though opening a new scratch doc seems more consistent with expected behavior for other editors

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@brianm brianm added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Mar 20, 2024
@Moshyfawn Moshyfawn added workspace Feedback for workspace management, layout, interactions, etc cli Command-line interface feedback and removed triage Maintainer needs to classify the issue labels Mar 21, 2024
@Moshyfawn
Copy link
Member

What version of Zed are you using? v0.128.0 seems to do exactly what you're describing.

@Moshyfawn Moshyfawn added the needs info / awaiting response Issue that needs more information from the user label Mar 21, 2024
@JosephTLyons JosephTLyons removed the admin read Pending admin review label Mar 26, 2024
@escobera
Copy link

This is happening to me as well on 0.130.6 and 0.131.4-preview

Another way to trigger this is:

  1. cd into any directory
  2. zed .
  3. cmd + q to quit zed
  4. zed . again in the same dir as last time
image

@williamviktorsson
Copy link
Contributor

Is this a regression?

@williamviktorsson
Copy link
Contributor

williamviktorsson commented Apr 22, 2024

Line 402 here does not run on app start from CLI which it should. Could it be a race condition on the information not having beeh transferred over the ipc channel?

zed/crates/zed/src/main.rs

Lines 395 to 410 in e1685de

match open_rx
.try_next()
.ok()
.flatten()
.and_then(|urls| OpenRequest::parse(urls, cx).log_err())
{
Some(request) => {
triggered_authentication = handle_open_request(request, app_state.clone(), cx)
}
None => cx
.spawn({
let app_state = app_state.clone();
|cx| async move { restore_or_create_workspace(app_state, cx).await }
})
.detach(),
}

Could the initial information about the program being started from cli be sent as arguments and not depend on being sent over IPC perhaps?

@notpeter
Copy link
Member

I can no longer reproduce what @escobera is describing.
I believe this behavior has been fixed at some point in the last 7 months (the workspace serialization routines were significantly altered over the summer).

I'm closing in favor of consolidating any remaining related concerns into this here:

Thanks for reporting.

@notpeter notpeter removed the needs info / awaiting response Issue that needs more information from the user label Nov 26, 2024
@hferreiro
Copy link
Contributor

I can reproduce with the latest stable version, same steps as #9592 (comment).

@notpeter
Copy link
Member

@hferreiro I cannot reproduce this. Could you blow away your workspace db folder and see if that helps:

cd ~/Library/Application\ Support/Zed/db
ls -l
rm -rf 0-stable

@hferreiro
Copy link
Contributor

hferreiro commented Nov 28, 2024

@notpeter still reproducible. I have to close with cmd-w to avoid this behavior.

@hferreiro
Copy link
Contributor

@notpeter can you reopen this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Command-line interface feedback enhancement [core label] workspace Feedback for workspace management, layout, interactions, etc
Projects
None yet
Development

No branches or pull requests

7 participants