Make disabling source formatting more reliable
The only effect of disabling source formatting is that SourceFormatterController::formatterForUrl() returns nullptr. But some of SourceFormatterController's member functions are unaffected by the disablement: hasFormatters() may still return true; formatters() may return pointers to mostly inactive ISourceFormatter objects; SourceFormatterController::projectOpened() bypasses formatterForUrl() and may "adapt the mode of the editor regarding indentation-style". So current SourceFormatterController's behavior in the disabled state is inconsistent and possibly incorrect. The inconsistency hinders major refactoring of formatterForUrl(). Only one unit test disables source formatting and never reenables it. Therefore it must be safe to "unload" all registered formatters in disableSourceFormatting() like unloadingPlugin() does; afterwards return early from pluginLoaded() and unloadingPlugin() if source formatting is disabled.
parent
630be51e
Please register or sign in to comment