-
Notifications
You must be signed in to change notification settings - Fork 50
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
Auto-reload filetypes when filetypes.toml is saved #1177
base: main
Are you sure you want to change the base?
Conversation
porcupine/plugins/filetypes.py
Outdated
def after_save(tab: tabs.FileTab, junk: object) -> None: | ||
if tab.path == Path(dirs.user_config_dir) / "filetypes.toml": | ||
# Reload all filetypes when the user saves filetypes.toml. | ||
# If user has chosen a custom filetype, leave the tab alone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just find a filetype with whatever filetype_name
is currently used? It still needs a fallback to get_filetype_for_tab()
in case the user deletes a filetype.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the user hasn't selected a custom filetype, we should call get_filetype_for_tab()
, because it is possible that filename_patterns
was modified.
When ran locally, the new test succeeds on both Windows and Linux (don't have a mac). In CI it succeeds on linux but fails on windows and mac. I will probably just skip the failures, as it doesn't seem to have anything to do with whether it actually works |
Still passes locally. |
This will interact badly with the editorconfig plugin. It should be able to override anything that filetypes sets. |
You could try using |
Fixes #411