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

Preferences and plugins not reloaded after saving them when package folder is symlinked #1154

Closed
JohannesMP opened this issue Mar 23, 2016 · 15 comments

Comments

@JohannesMP
Copy link

On mac, Build 3103 I'm having an issue where when I manually open, edit and save the user preferences file, the new saved settings are not applied. Furthermore, any actions that would modify the preferences result in the old preferences overriding the new ones I modified.

For example, I am able to type complete garbage in the preferences file, save it, and not receive JSON warnings as I would have in the past.

More frustratingly, any valid changes made to the preferences file, even just changing the font_size value manually, are ignored and replaced the next time an action modifies it, such as Sublime Text->Preferences->Font->Larger.

Demo of both typing garbage as well as attempting to modify just the font size:
sublimepreferences2

It used to be that modifying the preferences file would simply re-load it, and any invalid JSON would result in an error immediately. I would like the old behavior back.

It should be noted that the message reloading /Users/USER/Library/Application Support/Sublime Text 3/Packages/User/Preferences.sublime-settings does not appear in the console after manually editing and saving the file.

The only package I have installed is "Tomorrow Color Schemes", and this issue occurs even without it.

@FichteFoll
Copy link
Collaborator

Seems to be an isolated issue since it has always worked fine for me. (Win7, 3109)

By the way, your quoted text not appearing is expected since ST does not need to reload a changed file from disk if it changed the file by itself. The expected message would be reloading settings Packages/User/Preferences.sublime-settings.

@wbond
Copy link
Member

wbond commented Apr 6, 2016

Sublime Text 3109 on OS X.

Opened settings file, changed font size and saved the file. Sublime Text resized the font correctly.

If I create an error in the JSON, I get a warning immediately as a popup indicating the error.

I also tested adding gibberish to the JSON file, then changing the font size via the menu. Sublime Text properly re-wrote the settings file from memory, removing the gibberish.

@wbond
Copy link
Member

wbond commented Apr 6, 2016

Perhaps post the full contents of your console? This may help in identifying any issues.

@ghost
Copy link

ghost commented Apr 24, 2017

@wbond It can be related to Settings not reloading. Sublime doesn't reload settings if the User folder is a symlink. Many users sync their settings via Dropbox (Google Drive, One Drive & etc.) like described in Syncing.

@FichteFoll
Copy link
Collaborator

Note that I symlinked the entire Packages folder, which is probably the reason why it worked for me despite syncing over Dropbox.

@dahanbn
Copy link

dahanbn commented Aug 16, 2017

I can confirm the original issue with ST3, Build 1342, 64Bit on Windows 10, 64 bit. If I only symlink the user folder than ST won't recognise the changes and they will only be in effect after an restart. I tried the workaround from FichteFoll to symlink the whole packages directory that contains the user directory. That works and ST3 will immediately notice the changed settings upon saving.

@GlassGruber
Copy link

Thanks a lot for this tip, a warning for this should be in the docs too imo.

Also, if you go the full Packages folder sync way, it's better to ignore in your sync process the other folders inside Packages, so that only the User folder is synced.

In my case for ex. I use Syncthing (which is awesome btw) with the following ignore rules:

!/Packages/User
/Packages/
!/Packages

@keith-hall keith-hall changed the title Preferences not reloaded after saving Preferences not reloaded after saving when package folder is symlinked Aug 28, 2017
@keith-hall keith-hall changed the title Preferences not reloaded after saving when package folder is symlinked Preferences and plugins not reloaded after saving them when package folder is symlinked Aug 28, 2017
@deathaxe
Copy link
Collaborator

In https://packagecontrol.io/docs/syncing creating a symlink for the User directory is actively encouraged. Therefore a user can/must consider a symlinked package folder (User in this case) not to have any negative impact.

When opening the Packages folder as project all files in the sidebar withing the User package are not updated as well. Neigher deleted, renamed nor added files are recognized. Sidebar gets out of sync.

With those two facts in mind, I ask myself whether this issue points to a minor enhancement or rather a major bug?!

@FichteFoll
Copy link
Collaborator

Imo the instructions on https://packagecontrol.io/docs/syncing are just misleading since this has never worked.

I hardlinked my configuration files for syncing them with git. See FichteFoll/dotfiles@4b518e8 for details.

@deathaxe
Copy link
Collaborator

This issue drives the description on https://github.com/sublimehq/Packages how to use single packages from this repository useless. It is a pain to work with such packages and need to restart ST after each change. By copying the packages to ST you loose any opportunity to commit changes.

@wbond
Copy link
Member

wbond commented Feb 16, 2018

I've double checked this, both in the code, and tested it myself.

On Mac, as of build 3157, symlinks are traversed properly and events are handled correctly. I've test symlinking individual package folders (including User) along with the whole Packages and Installed Packages folders. This also explains why when I tested the Package Control syncing instructions, they worked fine, since I was using a Mac at that point. From reading the source, the code to handle symlinks on Macs has been as part of ST3 since some time in 2012. There have been some tweaks since then, but mostly to handle edge-case bugs.

Windows and Linux, however, do not handle symlinked folders within the data folder. This will be addressed.

However, this issue here is about a Mac. So my belief is either than something else on @JohannesMP's machine was causing an issue, or there was a bug in Apple's FSEvent library. There has been a report of symlinking to Dropbox on Mac would cause an issue also. I've tested that, and on macOS Sierra and the latest version of Dropbox, everything work properly.

@FichteFoll
Copy link
Collaborator

FichteFoll commented Feb 16, 2018

It would be nice if we could keep this issue about all platforms as multiple users, including myself (on both Windows and Linux) have indicated that they are suffering from this. There doesn't seem to be an issue for the general case, so let's just have #187 closed and keep this open as the general one.

Otherwise we'd need a new separate one.

@wbond wbond added this to the Build 3158 milestone Mar 2, 2018
@wbond
Copy link
Member

wbond commented Mar 29, 2018

This was fixed in build 3158.

@wbond wbond closed this as completed Mar 29, 2018
@wbond wbond added the R: fixed label Mar 29, 2018
@FichteFoll
Copy link
Collaborator

FichteFoll commented Sep 17, 2018

I recently made the switch to changing my hardlinked config files to symlink, but had to realize that ST only seems to be capable of monitoring symlinked directories, not individual files.

The changelog of 3158 has this to say:

File system notifications on Linux and Windows now account for symlinks (and Windows junctions)

However, when I change my Default keymap (or settings file) that is symlinked, the settings are not reloaded. That's quite unfortunate. Should I open a new issue for this, @wbond?

According to @OdatNurd, this seems to occur with settings, keymaps and command files, but not with menus for some reason.

@wbond
Copy link
Member

wbond commented Sep 17, 2018

I don't know why menus wouldn't be affected.

And yes, you should open a new enhancement request. We don't check individual files for symlinking on any platform.

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

7 participants