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

different workspaces in single instances not correctly opened #14747

Open
Tracked by #13192 ...
Freubert opened this issue Jan 20, 2025 · 13 comments · May be fixed by #15124
Open
Tracked by #13192 ...

different workspaces in single instances not correctly opened #14747

Freubert opened this issue Jan 20, 2025 · 13 comments · May be fixed by #15124

Comments

@Freubert
Copy link

Bug Description:

When trying to open several single instances of Theia AppImage or Snap app (Ubuntu 24.04), only the first instance opens the given workspace.

Steps to Reproduce:

  1. Open Theia with a workspace path as command line parameter
  2. Theia opens with given workspace loaded
  3. Open a second instance of Theia with a path of another workspace as command line parameter
  4. Theia opens without any workspace loaded

I didn't build Theia myself. I tried this with the downloadable AppImage and also with the snap package for Ubuntu 24.04.

Additional Information

  • Operating System: Ubuntu 24.04 (Gnome)
  • Theia Version: 1.57.1
@msujew
Copy link
Member

msujew commented Jan 20, 2025

Probably a consequence of #13831. cc @tsmaeder.

@sdirix
Copy link
Member

sdirix commented Jan 20, 2025

I can reproduce the issue. Something seems to go wrong when handling the command line parameters for the second "instance" (i.e. window). The error is likely located here or at least should be investigated starting from there.

@tsmaeder
Copy link
Contributor

@sdirix
Copy link
Member

sdirix commented Feb 11, 2025

I can confirm that this is fixed in the Electron example application in the Theia repository. Still should be retested again once we have new Theia IDE build.

@sdirix
Copy link
Member

sdirix commented Feb 24, 2025

@tsmaeder The 1.59.0 preview build does not fix the issue! The second "instance" still opens without an opened directory

@tsmaeder
Copy link
Contributor

@sdirix what command are you using to test this?

@tsmaeder
Copy link
Contributor

Considering it works with the in-repo version of theia, there must be something going on with the handling of cmd-line parameters in the native launcher.

@tsmaeder
Copy link
Contributor

I can confirm that doing

C:\Users\thomas\AppData\Local\Programs\TheiaIDE\TheiaIDE.exe C:\Users\thomas\code\theia\theia5

does not open the theia5 workspace in a second instance.

@tsmaeder
Copy link
Contributor

This is weird, since we're just listening to the 'second-instance' event on the electron app object. The only reason I can think why this should work differently is if the built version of electron somehow sending a different argv with the event. @jfaltermeier are you aware how the Theia executable starts the electron process?

@tsmaeder
Copy link
Contributor

It might be that we're simply running into this problem: electron/electron#4690 (comment)

@tsmaeder
Copy link
Contributor

It's a bit weird how we determine whether the app is packaged in electron-mainapplication.ts. Shouldn't app.isPackaged do exactly what we want?

@tsmaeder
Copy link
Contributor

@jfaltermeier what's the best way to test a fix that only happens in the built version of TheiaIDE?

@jfaltermeier
Copy link
Contributor

I think the easiest way is to publish your Theia build to a local npm registry like Verdaccio. This should be roughly how it looks:

In the Theia repository:
npm logout (optional, to ensure you can't accidentally publish to the real registry)
docker pull verdaccio/verdaccio
docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
npm login --registry http://localhost:4873 (you can enter any random credentials)
npm config set registry http://localhost:4873
Run the Theia release script

In the Theia IDE repository:
yarn config set registry http://localhost:4873
Follow https://github.com/eclipse-theia/theia-ide/blob/master/PUBLISHING.md#update-package-versions-and-theia to update to your local Theia version.

tsmaeder added a commit to tsmaeder/theia that referenced this issue Mar 6, 2025
Fixes eclipse-theia#14747

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <[email protected]>
@tsmaeder tsmaeder linked a pull request Mar 6, 2025 that will close this issue
2 tasks
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.

5 participants