diff --git a/formatters/astyle/astyle_plugin.cpp b/formatters/astyle/astyle_plugin.cpp --- a/formatters/astyle/astyle_plugin.cpp +++ b/formatters/astyle/astyle_plugin.cpp @@ -88,7 +88,8 @@ QString AStylePlugin::formatSource(const QString& text, const QUrl &url, const QMimeType& mime, const QString& leftContext, const QString& rightContext) { - return formatSourceWithStyle( ICore::self()->sourceFormatterController()->styleForMimeType( mime ), text, url, mime, leftContext, rightContext ); + auto style = ICore::self()->sourceFormatterController()->styleForUrl(url, mime); + return formatSourceWithStyle(style, text, url, mime, leftContext, rightContext); } static SourceFormatterStyle::MimeList supportedMimeTypes() diff --git a/formatters/customscript/customscript_plugin.cpp b/formatters/customscript/customscript_plugin.cpp --- a/formatters/customscript/customscript_plugin.cpp +++ b/formatters/customscript/customscript_plugin.cpp @@ -203,7 +203,8 @@ QString CustomScriptPlugin::formatSource(const QString& text, const QUrl& url, const QMimeType& mime, const QString& leftContext, const QString& rightContext) { - return formatSourceWithStyle(KDevelop::ICore::self()->sourceFormatterController()->styleForMimeType(mime), text, url, mime, leftContext, rightContext); + auto style = KDevelop::ICore::self()->sourceFormatterController()->styleForUrl(url, mime); + return formatSourceWithStyle(style, text, url, mime, leftContext, rightContext); } static QList stylesFromLanguagePlugins() diff --git a/languages/clang/codegen/sourcemanipulation.cpp b/languages/clang/codegen/sourcemanipulation.cpp --- a/languages/clang/codegen/sourcemanipulation.cpp +++ b/languages/clang/codegen/sourcemanipulation.cpp @@ -250,11 +250,12 @@ int line = findInsertionPoint(); decl = QStringLiteral("\n\n") + applySubScope(decl); + const auto url = declaration->url().toUrl(); QMimeDatabase db; - QMimeType mime = db.mimeTypeForFile(declaration->url().str()); - auto i = ICore::self()->sourceFormatterController()->formatterForMimeType(mime); + QMimeType mime = db.mimeTypeForUrl(url); + auto i = ICore::self()->sourceFormatterController()->formatterForUrl(url, mime); if (i) { - decl = i->formatSource(decl, declaration->url().toUrl(), mime); + decl = i->formatSource(decl, url, mime); } return m_changeSet.addChange(DocumentChange(m_context->url(), insertionRange(line), QString(), decl));