-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Currently load_config is called every time the plugin is asked to format the whole document, which requires finding the root of the project the Python file to be formatted, then finding the pyproject.toml file if any and parsing it into a dictionary. A simple way to cache these results is by using lru_cache decorator on load_config, however this can confuse users as changes to their pyproject.toml files would not be visible to python-lsp-black until the LSP server is restarted. For this reason config caching should be disabled by default and only enabled via explicit configuration.
Introduce a way to configure the behavior of python-lsp-black, starting with a cache_config setting that defaults to None. When set to an integer value it will be used for the lru_cache call on load_config.