ReloadSettings only when we need to when saving a file#3688
Merged
dmaluka merged 1 commit intomicro-editor:masterfrom Mar 12, 2025
Merged
ReloadSettings only when we need to when saving a file#3688dmaluka merged 1 commit intomicro-editor:masterfrom
dmaluka merged 1 commit intomicro-editor:masterfrom
Conversation
dmaluka
reviewed
Mar 11, 2025
internal/buffer/save.go
Outdated
|
|
||
| ft := b.FileType() | ||
| b.UpdateRules() | ||
| if b.FileType() != ft || newFile { |
Collaborator
There was a problem hiding this comment.
What if the file is not new but its path changes (i.e. after SaveAs)?
internal/buffer/save.go
Outdated
| b.ReloadSettings(true) | ||
|
|
||
| ft := b.FileType() | ||
| b.UpdateRules() |
Collaborator
There was a problem hiding this comment.
We only need to update rules exactly in the same cases when we need to reload settings (and thus would do that anyway as a part of ReloadSettings()), i.e. when path or filetype changes?
Contributor
Author
There was a problem hiding this comment.
Okay, I think we only need to check if the path has changed. If the user is setting the filetype manually, it already triggers ReloadSettings.
b68d509 to
d02758e
Compare
JoeKar
approved these changes
Mar 11, 2025
dmaluka
reviewed
Mar 11, 2025
d02758e to
370239d
Compare
dmaluka
reviewed
Mar 11, 2025
internal/buffer/save.go
Outdated
| b.UpdateModTime() | ||
| b.ReloadSettings(true) | ||
|
|
||
| // need to update glob-based and filetype-based settings |
370239d to
b3b765c
Compare
JoeKar
approved these changes
Mar 12, 2025
theredcmdcraft
pushed a commit
to theredcmdcraft/micro
that referenced
this pull request
May 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ReloadSettings only when we need to when saving a file instead of doing it every time when we save, which will also have the benefit of allowing old plugins to work.
Fixes #3687