Open ambihelical opened 3 years ago
Thanks for your suggestion!
Actually, editorconfig-core
already caching mechanism, and it seems to work also for remote files 🙆♂️ : https://github.com/editorconfig/editorconfig-emacs/blob/master/editorconfig-core-handle.el#L37
It uses file mtime to check if it has been changed last read, so I think the feature you suggested is partially implemented.
I think it would be worthwhile addition to cache editorconfig settings for remote directories (and perhaps all directories if performance warrants it). The cache would hold, for each directory cached, the editor config settings for that directory, including the case of no editor configuration at all.
The first open of a file incurs the penalty of full file system traversal up to the root, but the editor config for each directory visited is cached. The next file open hitting any cached directory is sped up.
There would need to be a way to invalidate the cache if any editorconfig changes have been made, but this should be infrequent. The use of the cache should be optional with a simple configuration setting.
With this in place the impact of traversing the file system for remote files can be ameliorated instead of out-right removing the functionality of editorconfig for remote files as #234 has done, at least by default. I appreciate the motivation for #234, but it breaks editorconfig for remote work out the box, and requires reconfiguration of the regexp list to bring it back.