Sublime Forum

File reloading in ST3

#1

I have noticed that file reload does not quite work in ST3. It works perfectly in ST2. Is it something in ST3 or does it have to do something to do with the python version that is bundled with it?

0 Likes

#2

When you refer to file reloading, are you talking about reloading the contents of the file when it changes on disk? Also, when you say “not quite work,” what exactly do you mean?

0 Likes

#3

Hi Will,

Yes I am talking about reloading the contents of the file when it changes on disk. When I say not quite work, I mean I have to select Revert File from the file menu to reload it. On ST2 I dont need to do that.

0 Likes

#4

In build 3032 there was a new setting always_prompt_for_file_reload added. Perhaps changing this would help? I haven’t tried to see.

0 Likes

#5

I have been running into the same problem with reloading files. I have noticed that if the files are stored on a linux machine and served up through a shared folder to a windows machine, Sublime does not always recognize that the file has been changed on disk.

This is a huge problem for us because we may pull in the latest version of code using our version control system, but sublime never reloads the file and it does not prompt to reload. The problem comes in when someone starts making changes to the “now updated” file (that has not been reloaded) and then they save the file essentially blowing away the updates on disk. Our version control system thinks we have the latest version at this point so it never warns us that we are checking in stale code, and we have had a few developers (including myself) who have checked in changes that undo previous checked in code. Granted most of the time this gets caught by comparing against the latest version prior to checking in, but that still leaves the task of having to manually merge in the code differences that should have been there in the first place.

ST2 users in my work place do not have this issue. I know this may be a limited/low priority item to be addressed, but some users at my work refuse to use sublime 3 for development for this reason alone.

I have been able to reproduce the issue by opening a file in sublime and then in a putty session changing the file through a command line editor like vi. When you return to Sublime, the file will not prompt to reload and a “ReadDirectoryChangesW fails error code 58” exception is thrown, which I know is a windows generated error.

We are using windows 7/8 64-bit if that is of any use.

0 Likes

#6

Seems to be working for me in the latest dev build on Linux at least. I will check windows when I get a chance.

0 Likes

#7

In general I don’t believe filesystem notifications happen for non-local drives. So, samba, appletalk, nfs and sshfs generally will run into issues. Not to mention that performance on such filesystem tends to be crummy due to the slow link speed, especially when indexing files.

0 Likes

#8

I’ve explored using rsync to keep a local copy for development which would sync with the shared folder, but that is one extra step for configuration that other developers at my work will not want to do.

If there was an option in Sublime to fall back to the old method in ST2 for file reload, or implement something new for ST3 that would recognize the file change it would make my life much easier.

I’ve tried to implement my own method to check if the file has changed, but nothing worked as well enough to pass a s viable solution.

0 Likes

#9

Hi Will,

I tried the option, but no luck. If ST uses python to do the file IO, I suspect it has something to do with the python version being used. Else something broke in ST3.

Here are the steps to reproduce the issue.

  1. Use a zip version of both ST2 and ST3.
  2. Load a changing file say a log file from tomcat.
  3. Observe that ST2 reloads the file automatically whereas on ST3, you need to use File Revert.

BTW, I am using Windows 7 PRO 64bit.

Cheers

0 Likes

#10

ST does not use python for file io. Python is only used for a handful of default commands (defined in the default package) and whatever plugin do.

0 Likes

#11

Is it because I am using a zip package rather than a normal installer based one? The ST2 that I am using is a installer based one. It is able to reload files perfectly.

0 Likes

#12

I’ve tried both versions of ST3 and they both had the same problem when the files were shared from a Linux machine. I’m sure it’s still the same compiled code for sublime text for both versions

0 Likes

#13

@jps just released Build 3101 which essentially merges how ST2 and ST3 detect file changes. I have not tested this yet, but I wanted to pass thing along incase this solves your problems on ST3.

0 Likes

#14

I will be trying it out shortly. Hope this build resolves it for me.

0 Likes

#15

Build 3102, seems to have solved the file reloading issue for me. Thanks.

0 Likes

#16

Awesome! This has cleared things up for me as well.

0 Likes

#17

I am experiencing failed file reloads on Mint 17.3 with ST3 build 3143.

I have disabled the automatic reload so that I can confirm the reload attempt is being made. I also see indication of reloading the file in the console but the contents of the file are not being reloaded.

The file is only properly reloaded if I close and reopen it or use the revert command.

update: I downloaded 3156 as tar.xz to run without installing and I’m seeing the same behavior. Reloading seems to work ok if I have multiple views into the file in the same Sublime Text instance. Editing the same file in two instances or just outside of Sublime Text seems to be the issue.

0 Likes