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

Multiple vscode windows, one git project: magit.commit opens in wrong window #301

Open
the-kenny opened this issue Jun 11, 2024 · 2 comments · May be fixed by #302
Open

Multiple vscode windows, one git project: magit.commit opens in wrong window #301

the-kenny opened this issue Jun 11, 2024 · 2 comments · May be fixed by #302

Comments

@the-kenny
Copy link

I'm working on a sort-of monorepo where I have multiple projects open in separate vscode windows. The setup is roughly the following:

root/
├── .git/
├── subfolder1/
├── subfolder2/
└── special_subfolder/

Usually, two vscode instances are open: One for root/ (to work on root/ as well as subfolder1/ and subfolder2/) and one for special_subfolder/.

edamagit handles this fairly well: I can simultaneously use it in every window without major hiccups, with one issue:

When I run magic.commit in the vscode instance for special_subfolder/, COMMIT_EDITMSG is opened in the instance for root/, with everything else staying in the instance of special_subfolder/. I expect COMMIT_EDITMSG to open in the instance magic.commit is executed.

Is there a configuration option I missed, or is this an unusual use case that isn't covered (yet)?

If you consider this a bug, would you accept a PR for a fix?

@the-kenny
Copy link
Author

Root cause seems to be that GIT_EDITOR is set to "${codePath}" --wait, causing git (in the special_subfolder/ instance) to run code --wait ../.git/COMMIT_EDITMSG. Vscode is smart and recognises this path belonging to the workspace for root/ and opens the file in the instance.

One workaround is to change the command to code --wait --reuse-window . (the . being the most relevant part) which should force vscode to open the path to COMMIT_EDITMSG passed as the next argument in the instance for the current folder.

I'll try this locally and see if there are any unintended side effects and keep you updated.

@the-kenny
Copy link
Author

I've been using my fix (#302) on macOS for the last two weeks and it seems to work fine without any unintended side effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant