Sublime Forum

Sublime text 3 does not refresh files correctly!

#1

Hello,

I keep seeing this bug from time to time - ST3 does not refresh files correctly. It keeps old version of file, I figured that out because sometimes I change one line in the file, then save but git diff command shows me i.e 100 lines changed (not new line difference) just old changes I made long time ago.
I tried to close and open again the file, refresh folders option neither one helps.
I use build 4126

Please help with that as this bug makes sublime not usable at all

0 Likes

#2

Can you be more specific as to when ST is opening an old version of a file? Did you change the file externally to ST?

0 Likes

#3

I also feel like this may happen due to ST applying some conversion of TABs/SPACES.
Here are my settings:
{
“default_line_ending”: “system”,
“dictionary”: “Packages/Language - English/en_US.dic”,
“ensure_newline_at_eof_on_save”: false,
“always_prompt_for_file_reload”: false,
“font_size”: 11,
“show_encoding”: true,
“show_line_endings”: true,
“spell_check”: true,
“tab_size”: 8,
“theme”: “auto”,
“dark_theme”: “Default Dark.sublime-theme”,
“light_theme”: “Default Dark.sublime-theme”,
“draw_unicode_white_space”: “none”,
//“file_exclude_patterns”: [""],
//“find_highlight_matches_max_size”: 1073741824, // 1 Gb (MR)
//“find_regex_highlight_matches_max_size”: 1073741824, // 1 Gb (MR)
//“find_in_files_max_result_size”: 1073741824, // 1 Gb (MR)
“ignored_packages”:
[
“Vintage”,
],
“update_check”: false,
}

what can cause this?

0 Likes

#4

You haven’t answered either of my questions.

0 Likes

#5

Of cource I have not edited this file externally to Sublime (or at least I am not aware of it).
As for when exactly, I can’t tell - all I see is the file content is different in Sublime and what say VIM is showing. More so, when I do a small edit to the file in sublime, and save it GIT shows plenty of changes - the files is not up to date.

0 Likes

#6

is the file in Windows WSL or a network mount?

0 Likes

#7

Does the file show as unsaved (a circle instead of an x as the close button for the tab)? How are you opening the file?

0 Likes

#8

It is a regular file system.

0 Likes

#9

No, the file shows as saved from the sublime perspective.

0 Likes

#10

How are you opening the file?

0 Likes

#11

I have an entire folder loaded into sublime, and from the file tree I just open files. Or I use ctrl + P shortcut and type its name.

Also, this issue happens very rarely but when it does there is no way to recover.

0 Likes

#12

To be clear, the behavior you’re seeing is:

  • You don’t have file A open in Sublime Text
  • You open file A using the side-bar or goto-anything
  • The loaded file in Sublime Text does not match the file on disk, but it does match an older version of said file.
  • If you open file A in another editor it shows the actual content on disk.

If that’s the case then I don’t see how that’s possible without a plugin being the cause. Does it happen in safe mode?

0 Likes

#13

" You don’t have file A open in Sublime Text" - No I have it opened, was working on it, saving, editing back and forth. I also checked out other version of the file using external tool, GIT in this case. (I somehow connect this problem with my git actions on a side). When the issue happened, I closed the file and opened again, hopping it will help, but it doesn’t
" The loaded file in Sublime Text does not match the file on disk, but it does match an older version of said file." -> Yes for the first part. As to if the content is an old version of the file or not I am not entirely sure.
" If you open file A in another editor it shows the actual content on disk." - Yes, exactly. GIT proves the content is as other editors have i.e VIM

" If that’s the case then I don’t see how that’s possible without a plugin being the cause. Does it happen in safe mode?" Well the thing is I do not have any plugins installed at the moment. Haven’t tried with safe but as for now I have no clue how to reproduce the issue.

0 Likes

#14

I also checked out other version of the file using external tool, GIT in this case.

Right, so the file did get edited externally to ST. What likely happened is ST was not notified of this change for one reason or another.

Do you see any errors in the console (View > Show Console)? What platform are you on? If you’re on windows are you using WSL?

0 Likes

#15

But how can ST not be notified? Git checkout just changes the file on the disk so the question is why ST doesn’t recognize a change to the file in the system?

As for Console, currently I don’t see any error however I see some plugins are actually:
eloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading python 3.3 plugin 0_package_control_loader.00-package_control
reloading plugin Default.copy_path
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading python 3.3 plugin Package Control.1_reloader
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading python 3.3 plugin Package Control.2_bootstrap
reloading plugin Default.html_print

When the error happens again I will look at console, previously I didn’t.
I am on windows, no WSL.

0 Likes

#16

Are the files on a USB key or on your primary drive for Windows? Can you please paste the full console output. If you’re not comfortable sharing that on the open internet you can direct message me.

0 Likes

#17

The repository is on a primary SSD. Instead of pasting whole console output, can you tell me what should I look for? My quick inspection shows a few lines in the command line that are suspicious:

  1. Saving the session file took longer than expected. This may result in slowdowns and is usually caused by large unsaved files, large number of selections or misbehaving plugins. (build: 1213ms, encode: 687ms, write: 336ms)
  2. Unable to open clipboard (many times!)

Other than that I only see regular file READ/RELOAD entries.

0 Likes

#18

The issue just happened to me again.
What I see from console log is that this file that is not being refreshed has not been reloaded for a long time as it probably should has been as part of git checkouts/resets/rebased etc.
The questions is why sublime is not refreshing this file?

0 Likes

#19

It’s possible you’ve encountered a bug where the recursive file watching misses a folder. Does Project > Refresh Folders make ST notice the changed file?

0 Likes

#20

Unfortunately not :frowning:

0 Likes