sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
803 stars 39 forks source link

sublime text keeps opening up new intances of itself #5224

Open trix1210 opened 2 years ago

trix1210 commented 2 years ago

Description of the bug

sublime text keeps opening up new intances of itelf. I have 20 sublime texts open all with the same windows in them!! Whats going on ?

Im using unregistered stable channel build 4126

Steps to reproduce

i double click on a .php file and it opens in one of the sublime text windows.

Expected behavior

sublime text shouldnt keep duplicating itself

Actual behavior

sublime text keeps duplicating itself

Sublime Text build number

4126

Operating system & version

windows 10 pro

(Linux) Desktop environment and/or window manager

No response

Additional information

No response

OpenGL context information

No response

BenjaminSchaaf commented 2 years ago

Does it happen in safe mode?

jfcherng commented 2 years ago

Try to use subl.exe to open a file rather than sublime_text.exe?

deathaxe commented 2 years ago

I also use sublime_text.exe only to open documents. Both the context menu links and file associations call it directly. Haven't encountered any issues on Win 10/11 so far.

Maybe something is blocking ST from checking, whether it's already running? May happen if it doesn't have privilidge to query running processes.

absop commented 2 years ago

I often see ST reporting an error message on its console "indexing: crawldb not available, indexing abandoned". At this point, I would consider shutting down ST and deleting its Index folder, but it always fails because there are other ST processes in the background and killing them will fix the error.

5136

trix1210 commented 2 years ago

Try to use subl.exe to open a file rather than sublime_text.exe?

Good suggestion - Ill try it. Then again, ST should re-use an existing window... These instances are multiplying on their own, its not isolated to me opening a new file..

trix1210 commented 2 years ago

Does it happen in safe mode?

I havent tried this as i my pc is always on; it might never boot up again if I restart it !!

BenjaminSchaaf commented 2 years ago

Safe mode is a ST feature, not the safe mode of your operating system. See https://www.sublimetext.com/docs/safe_mode.html

rafael-copat commented 2 years ago

Hi all, I am also having this issue sometimes. I have an open project I am working on and I open a new file in File Explorer by pressing enter. Sometimes Sublime creates a new workspace for the project and opens the file in that new window. Sometimes Sublime just opens a new empty window and then opens the file there. Just to be clear, I have the default setting of "open_files_in_new_window": "never",. I cannot reproduce this behavior consistently. Sometimes it works correctly. If I am able reproduce this consistently, I will try it in safe mode.

Trying to change from sublime_text.exe to subl.exe did not make any difference for me.

By the way, I am using Windows 10, ST 4126.

BenjaminSchaaf commented 2 years ago

The only time a new window is opened should be when specifically requested by the -n option, when "open_files_in_new_window" is "always" or when a folder/workspace/project is opened.

@rafael-copat is a new application instance being launched or just a new window being opened?

rafael-copat commented 2 years ago

Hi @BenjaminSchaaf , I am not sure what the difference is between a new ST instance and a new ST window. Can you please clarify how I can identify one or the other?

BenjaminSchaaf commented 2 years ago

You can find out by checking task manager for another, separate Sublime Text process.

trix1210 commented 2 years ago

You can find out by checking task manager for another, separate Sublime Text process.

Ok but how does this solve my problem?

BenjaminSchaaf commented 2 years ago

@trix1210 I was replying to the other commenter. I can't help you further until you've tried safe mode.

trix1210 commented 2 years ago

@trix1210 I was replying to the other commenter. I can't help you further until you've tried safe mode.

Oops sorry! Still getting used to this forums' format!

rafael-copat commented 2 years ago

You can find out by checking task manager for another, separate Sublime Text process.

Hi @BenjaminSchaaf, it seems to be an issue with projects. I open ST, go to Project -> Quick Switch Project, and select my project. Open Command Prompt and type subl. Sometimes ST opens a new instance (two different processes in the task manager) with an empty window, sometimes with the same workspace (same folders, open files, etc.), and sometimes ST just focuses on the project window (expected behavior). If I open just one file instead of a project, I do not have this issue. In other words, after typing subl will just switch the focus to the ST window.

I am not sure how to test this in safe mode, as every time I type subl --safe-mode, ST opens a new window in safe mode.

BenjaminSchaaf commented 2 years ago

@rafael-copat Running subl --safe-mode with a ST process in safe mode running should act the same as ST outside of safe mode. As such you should be able to reproduce the issue there if it's an issue outside of plugins/configuration.

rafael-copat commented 2 years ago

@BenjaminSchaaf, if that is the expected behavior, then the issue does happen in safe mode.

Steps to reproduce: 1) Close any instance of ST. 2) Open cmd.exe, type subl --safe-mode; 3) Focus on ST safe mode, type lorem, press tab; 4) Save plain text file; 5) Focus back to cmd.exe, type subl --safe-mode.

Expected behavior: Windows would focus on ST in safe mode. Actual behavior: A new window of ST in safe mode is opened (same instance, based on Task Manager).

BenjaminSchaaf commented 2 years ago

If it's using the same instance then that seems unrelated to this issue?