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

Add option to disable auto-reload file content #1666

Closed
menkow opened this issue Apr 17, 2017 · 48 comments
Closed

Add option to disable auto-reload file content #1666

menkow opened this issue Apr 17, 2017 · 48 comments

Comments

@menkow
Copy link

menkow commented Apr 17, 2017

If I am viewing a huge logfile of +200MB and it is often updated (each second), it is very annoying that ST3 reloads it - I would even say useless.
There should really be an option to control the auto-reload so it can at least be disabled.

@keith-hall
Copy link
Collaborator

keith-hall commented Apr 17, 2017

you mean rather than set the following, you want an option so that it will never auto-reload files and never ask to either?

    // Always prompt before reloading a file, even if the file hasn't been
    // modified. The default behavior is to automatically reload a file if it
    // hasn't been edited. If a file has unsaved changes, a prompt will always
    // be shown.
    "always_prompt_for_file_reload": true,

@keith-hall
Copy link
Collaborator

keith-hall commented Apr 17, 2017

It might be useful to configure it for certain syntaxes or file sizes:
https://forum.sublimetext.com/t/do-not-auto-reload-big-logfiles/12476

EDIT: (i.e. two settings, one that works in syntax-specific settings files to disable auto reloading entirely, and one that can control the maximum size of file that should (prompt to) auto-reload)

@menkow
Copy link
Author

menkow commented Apr 18, 2017

@keith-hall Yes I want new option, because with "always_prompt_for_file_reload": true its still unusable for view file (confirmation window appears every second).

@RobertoGata
Copy link

We often need a setting not to update the file
We work both with large files and constantly updated.
Notepad ++ has this simple setup, you need to do it!
Many of our computers already have only sublime!
Keep quality at a high level.

@vad-eroshevichev
Copy link

+1

@pratyushtewari
Copy link

pratyushtewari commented May 2, 2017

When I am debugging and reading logs, I need to do it on a live file and move back and forth to other application. When I come back to ST3, the file flashes and is scrolled back to the top and I loose my line. I've been trying to get rid of this issue for a very long time and gave up and started reading the log file in notepad++ in parallels. Would love to use ST3 again as I really like using it and I am quite handsy with the various shortcuts in ST3.

I think this feature has been requested for many years now. I request the Sublime developers to focus on this issue asap.

@pratyushtewari
Copy link

Besides disabling the auto-reload it would be really helpful if ST3 can convey that the file was updated outside ST3 and provide a way (or a keyboard shortcut) to reload the file quickly.

Look at the following screenshots:

1 file updated
2 file updated - on hover

@keith-hall
Copy link
Collaborator

One could easily bind a key to the revert command to reload a file easily :)

@wamatt
Copy link

wamatt commented May 6, 2017

Viewing large active log files is effectively unusable in ST3

@menkow
Copy link
Author

menkow commented May 10, 2017

@keith-hall the described solution (with screenshots) is not for the problem to reload file with shortcut, but how can i determine are the file was updated or not (if i switched off auto-reload option in future).
p.s. sorry for my bad english

@keith-hall
Copy link
Collaborator

@menkow currently, the following setting will be picked up by your theme to display the tab differently when the file has been modified:

// Makes tabs with modified files more visible
"highlight_modified_tabs": true,

However, this would only be helpful if you haven't made any changes to the file in ST, because there would be no way (with the current system) to tell whether the changes to the file were made in ST or externally (or both). If/when the ST devs do end up implementing this, most likely they will update the theme documentation to mention a new attribute that themes can use to distinguish "dirty" files from those changed in ST and those changed outside ST, but this is purely speculation on my part.

@byronformwalt
Copy link

Affects editing files on remote volumes via MountainDuck on the Mac. File reloads are attempted by ST3 each time a file is saved, obliterating any code folding and momentarily blanking out the content pane due to network latency. It would be really nice to inhibit attempts by ST3 to reload based on the mounted volume where the changes occur.
👍

@pratyushtewari
Copy link

Admins, please look into this enhancement.

@evandrocoan
Copy link

Some few options for Sublime Text to handle big files:

  1. Sublime Text should silently reload the file, i..e, without the loading bar showing up the screen. But when this process is happening the user cannot interact, i.e, edit the current file, only view it.
  2. Sublime Text should only load the last appended lines, as usually a log file only has the only content appended to the file. So Sublime Text could continue loading the file only after the last line loaded.

Detect when a file is too big and perform a silent reload, not presenting the load bar. Just put some sign to the user on the status bar, stating the file is being silently reloaded. And if the user wishes:

  1. Stop the current reload.
  2. Stop the current reload and disable the silent reload for the current file, until you close it and open again.

Also a option to do a silent reload now. So the user can to reload the file, when he wants to. It would be useful when the user disabled the silent reload for the current file, or globally on the settings.

@pratyushtewari
Copy link

pratyushtewari commented Jul 25, 2017

@evandrocoan, I might have misunderstood your comment here. We are discussing how to stop the silent reloads because it messes up with trace, search and reading logs and not do silent reloads in general. In our option if the silent reload option is off then Sublime should present the user with a visual indication that the file was modified. So the options we are looking at are described in

#1666 (comment) and older comments than that.

@evandrocoan
Copy link

Sorry, I will opened a new issue specifically for this suggestion on how handle the file reload.

@ericsubach
Copy link

I agree this is a useful option. This affects me even if I have a different file opened -- if I try to highlight text in my current file and a background file is reloaded, my current highlight is interrupted.

@keith-hall
Copy link
Collaborator

@ericsubach that bug is being tracked here: #1177

@fareloz
Copy link

fareloz commented Sep 14, 2017

Agree with the author. It is so annoying when you are working with logs files. I don't want to see reload asking window! I just want to not reload the document automatically and only on my request.

@pratyushtewari
Copy link

I finally switched to VScode and it is not only way-way faster to load big files but also you can move the search results panels around. VScode has become by default IDE now.

@clevijoki
Copy link

This also seems to kill performance when a large number of files are modified. Often sublime becomes unusable for me, (and stuck at 20% cpu usage) when I have a large number of writes happening, even if those files are not in the sublime workspace. So perhaps there is a problem with the way callbacks happen which consume CPU power.

I would prefer a way to just disable all file watchers.

@XenHat
Copy link

XenHat commented Nov 5, 2018

A good way to implement this setting would be to provide a customizable flag/option for syntax definitions which would control the default behaviour of the file watcher for this syntax. This would allow code to reload automatically, but by shipping ST3 with the auto reload disabled for the TXT syntax would solve the issue. This would also enable custom syntaxes from packages to have their behaviour set by the plugin maintainer.

If implemented this way, a pair of new settings should be created, to list file extensions to ALWAYS and NEVER auto reload, similar to the search ignore list.
A runtime toggle for the current syntax would also be nice, which could be saved through the previously mentioned extension lists.

@FichteFoll
Copy link
Collaborator

FichteFoll commented Nov 5, 2018

I like the suggestion, but imo it should just be a normal view setting. View settings are sourced from project and also syntax-specific settings, so everything you described is also possible through syntax-specific settings. In addition to this, you could enable or disable it per view.

@XenHat
Copy link

XenHat commented Nov 5, 2018

Convenient!

@baoanhng
Copy link

baoanhng commented Nov 17, 2018

Do we have any plugins or workaround?

I just couldn't believe that ST3 does not have this implemented yet.

@evandrocoan
Copy link

evandrocoan commented Nov 17, 2018

On the latest development build I am experiencing a random bug which stops reloading some views from the file system:

  1. Does not auto reload the view contents of some views #2480 Does not auto reload the view contents of some views

But, I am not sure how to trigger it yet.

@istvans
Copy link

istvans commented Nov 28, 2018

We still really need a solution for this.

@JashanChittesh
Copy link

This should not be that difficult to implement: All you need to do is add an option "file_reload_on_changed_in_filesystem: true;" ... and only execute the file-system watcher when this is true. If you want to make it fancy, an option in the tab context menu would be even better. But just that option in the preferences / settings would already be enough for me.

Without this, I need to make a copy of the logfile to load it up in Sublime Text. That's not cool.

@menkow
Copy link
Author

menkow commented Jan 24, 2019

After almost two years and many comments with same issue from users its still not implemented minor feature, why @keith-hall ?

@evandrocoan
Copy link

@Gpinchon
Copy link

I am having the same issue at work, trying to read some large log file, while a program updates it, it is unusable.

@38leinaD
Copy link

38leinaD commented Apr 4, 2019

Same issue with large logfiles here. Unable to take a look into the file while the log-file is updated in the background...

@luckman212
Copy link

Came here hoping for the same feature. This would be so useful!

@LeahDWood
Copy link

I'd love to see this as a feature also. I like the refresh idea above, potentially a pause/resume icon instead to toggle the auto-refresh behaviour would be an improvement?

@ned-martin
Copy link

ned-martin commented May 29, 2019

I also need this option. Automatically reloading a file is not usable for many people (such as myself) and makes this editor useless in many situations.

The way this works in most other editors that I have used is:

  • While the editor is active, if a file is changed on disk, a visual indicator shows this (usually the same indicator for "file is dirty", however the file is not automatically reloaded and there is no prompt.
  • The editor prompts to reload a file if there's changes only when it becomes active, that is, if you have switched to another application, and switch back to the editor, it will prompt "File changed on disk. Reload? Yes|No" or similar
  • Better editors have options to control this behaviour so it can be configured as desired.

This seems to be a basic feature that almost every editor I have used has, which Sublime is missing.

@evandrocoan
Copy link

@menkow, if you are using Linux, due this other bug:

  1. SSHFS long refresh waits #1409 SSHFS long refresh waits

You can "disable" the auto reload of the files by mounting your files by sshfs. In this case, you can connect by ssh with your own computer and mount the file somewhere else. This will be enough to stop Sublime Text from realoading the files automatically.

I use this to mount my own files somewhere else and stop Sublime Text from reloading them:

mkdir myowncomputerroot
sudo sshfs -o allow_other,uid=1000 root@127.0.0.1:/ myowncomputerroot/

This assumes you have ssh and sshfs installed and configured to allow root login.

@menkow
Copy link
Author

menkow commented Jul 12, 2019

@evandrocoan, thx for the tricky workaround, but my servers on Windows.
But, there is some good news from "sublime" folks.

@jrappen
Copy link
Contributor

jrappen commented Nov 15, 2019

According to the changelog fixed in Build 4050.

@evandrocoan
Copy link

@jrappen the build 4050 should be a secret so for I know. Such that this is labeled in a millstone called "next dev cycle". @FichteFoll, can you delete both our comments?

@wbond
Copy link
Member

wbond commented Nov 15, 2019

@evandrocoan 4050 is in limited beta release, although not secret, just not published in high-traffic areas. We will publish more info once it is ready for mass consumption.

@BenjaminSchaaf
Copy link
Member

BenjaminSchaaf commented Jun 2, 2020

This is fixed for the current ST4 development build. "reload_file_on_change" has been added, which allows disabling reloading entirely. In the "Do you want to reload it?" popup there is now the option to "Ignore All" changes for that particular file. That option simply sets the "reload_file_on_change" setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests