Sublime Forum

Sublime Merge doesn't update automatically for repositories inside WSL2

#1

Hi! I recently purchased Sublime Merge and I’ve been enjoying it. However, it’s been annoying having to manually refresh when working with a WSL folder on Windows 11. When I use Sublime Merge on macOS or native Ubuntu it works fine, but mixing the Windows version of Sublime Merge with the Linux filesystem seems to cause problems.

I am working with a Git repository that exists inside the Ubuntu WSL filesystem in Windows 11.

Is there any way to get Sublime Merge to auto-refresh? VS Code and JetBrains products seem to successfully watch the Windows Subsystem for Linux filesystem, so I think it’s possible.

Sublime Text also works poorly with the WSL2 filesystem. Deleting files doesn’t work and it doesn’t watch the filesystem. I think fixing this bug in Merge could also fix it in Text.

Thanks!

0 Likes

#2

WSL filesystems mounted to Windows don’t support filesystem notifications, so there’s no way to actually watch those files. Implementing polling as a fallback is unfortunately the only solution to this.

0 Likes

#3

Tragic. I guess I’ll go complain to Microsoft.
Thanks for the response.

0 Likes

#4

Hello, I recently ran into the same issue, but I have discovered a workaround.

Specifically, the workaround is to run Sublime Merge inside WSL’s Linux VM. This is then capable of using the native file-watching APIs. It can also display GUI windows in Windows. I also run Sublime Text natively, as the loss of file-watching is much less of a problem there. (It only affects the file list widget.)

I did find that an unfortunate side affect of running Merge in WSL is that Sublime Merge’s “Open in Editor” feature breaks. However, I made a shell script that fixes it. It translates WSL paths into Windows paths, and also accounts for the : characters that can appear when editing a specific line. Here is the script: https://gist.github.com/nickodell/1834b190218c0fecb6733680f3407cb5 Use this script by putting it in your WSL system, then changing Sublime Merge’s editor path to this script.

This approach is not perfect - the UI scaling is strange, and the Sublime Merge window takes a really long time to open, but it does work, and is significantly smoother than having to press refresh all the time.

0 Likes