Commit 32b8692d authored by Igor Kushnir's avatar Igor Kushnir
Browse files

ClangSupport: override indentationSample()

ILanguageSupport::indentationSample() is used in a single place:
CustomScriptPlugin::computeIndentationFromSample(), which in turn is
used only in CustomScriptPlugin::indentation(). When indentationSample()
returns an empty string (as the base class implementation does),
CustomScriptPlugin::indentation() fails and returns invalid Indentation.

f31d32f4 removed CppLanguageSupport,
which was the only class that overrode indentationSample(). Not copying
this override into ClangSupport was probably a mistake. This commit
copies the last version of CppLanguageSupport::indentationSample() into
ClangSupport::indentationSample(). The copied sample matches the example
in the documentation for ILanguageSupport::indentationSample().
parent a7901dc4
Pipeline #96399 canceled with stage
......@@ -350,6 +350,11 @@ QPair<QWidget*, KTextEditor::Range> ClangSupport::specialLanguageObjectNavigatio
return {nullptr, KTextEditor::Range::invalid()};
}
QString ClangSupport::indentationSample() const
{
return QStringLiteral("class C{\n class D {\n void c() {\n int m;\n }\n }\n};\n");
}
TopDUContext* ClangSupport::standardContext(const QUrl &url, bool /*proxyContext*/)
{
ClangParsingEnvironment env;
......
......@@ -56,6 +56,8 @@ public:
QPair<QWidget*, KTextEditor::Range> specialLanguageObjectNavigationWidget(const QUrl& url,
const KTextEditor::Cursor& position) override;
QString indentationSample() const override;
ClangIndex* index();
KDevelop::TopDUContext* standardContext(const QUrl &url, bool proxyContext = false) override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment