porcupine
porcupine copied to clipboard
Redesign and rewrite some parts of `porcupine.settings`
I'm no longer happy with some of the things it does. There are many small problems, so I decided to just make one issue about them.
In #1193, I discovered that the JSON serializing code is leaking memory. I should replace the class-in-function hack it's using now with something much simpler.
To merge tab settings from multiple places, such as .editorconfig
and filetypes.toml
, it would be nice to provide a priority when settings are set. Then the .set()
with highest priority would be used. For example, the editorconfig plugin would use a higher priority than the filetypes plugin, so that it overrides whatever filetypes sets. The loading order is no longer enough, because I want to reload filetypes.toml
configs without reloading editorconfigs, but things set in editorconfig
should still take precedence.
In the past, benjamin-kirkbride has been confused by settings.get("setting_name", list[str])
. It looks somewhat like dict.get
, but behaves differently.
If a setting can be None
, you can still .get()
it with a non-None
type whenever it isn't set to None
. You then get a runtime error when the value is None
. See #1440 for an example.