Commit a1874920 authored by Yuri Chornoivan's avatar Yuri Chornoivan
Browse files

Fix minor typos

parent 497a72ef
......@@ -525,7 +525,7 @@ int findLastMethodLine(ClassDom aClass, CodeModelItem::Access access);
int findLastVariableLine(ClassDom aClass, CodeModelItem::Access access);
/**
* Get the string representation of an accesss pecifier
* Get the string representation of an access specifier
* @param access An access specifier to get a string representation of.
* @return string The representation of an access (e.g. "public").
* @author Jonas Jacobi <j.jacobi@gmx.de>
......
......@@ -1584,7 +1584,7 @@ QList<CompletionTreeItemPointer> CodeCompletionContext::completionItems(bool& ab
///TODO: function-like statements should just be handled as a function with declaration etc.
/// e.g.: empty, eval, die, exit, isset, unset
/// but _not_ echo, print, catch, include*, require*
///TODO: use user's style for indendation etc.
///TODO: use user's style for indentation etc.
ADD_KEYWORD2("abstract class", "abstract class %SELECT%NAME%ENDSELECT% {\n%INDENT%\n}\n");
ADD_KEYWORD2("final class", "final class %SELECT%NAME%ENDSELECT% {\n%INDENT%\n}\n");
ADD_KEYWORD2("class", "class %SELECT%NAME%ENDSELECT% {\n%INDENT%\n}\n");
......
......@@ -203,7 +203,7 @@ const QString indentString(KTextEditor::Document *document)
return "\t";
}
QString getIndendation( const QString &line ) {
QString getindentation( const QString &line ) {
return line.left(line.indexOf(QRegExp("\\S"), 0));
}
......
......@@ -59,15 +59,15 @@ QStringList getMethodTokens(QString text);
const QString KDEVPHPCOMPLETION_EXPORT indentString(KTextEditor::Document *document);
/**
* Get the indendation of a given line.
* Get the indentation of a given line.
*
* You usually want to use it with something like the following:
*
* \code
* const QString indendation = getIndendation( document->line(replaceRange.start().line()) );
* const QString indentation = getindentation( document->line(replaceRange.start().line()) );
* \endcode
*/
QString KDEVPHPCOMPLETION_EXPORT getIndendation( const QString &line );
QString KDEVPHPCOMPLETION_EXPORT getindentation( const QString &line );
}
#endif
......
......@@ -117,22 +117,22 @@ void ImplementationItem::execute(KTextEditor::Document* document, const KTextEdi
replaceRange.start() = KTextEditor::Cursor(methodText.count('\n'), methodText.length() - methodText.lastIndexOf('\n') - 1);
}
// get indendation
QString indendation;
// get indentation
QString indentation;
{
QString currentLine = document->line(replaceRange.start().line());
indendation = getIndendation(currentLine);
indentation = getindentation(currentLine);
if ( !currentLine.isEmpty() && currentLine != indendation ) {
if ( !currentLine.isEmpty() && currentLine != indentation ) {
// since theres some non-whitespace in this line, skip to the enxt one
replText += '\n' + indendation;
replText += '\n' + indentation;
}
if (indendation.isEmpty()) {
// use a minimal indendation
if (indentation.isEmpty()) {
// use a minimal indentation
// TODO: respect code style
indendation = " ";
replText += indendation;
indentation = " ";
replText += indentation;
}
}
......@@ -148,12 +148,12 @@ void ImplementationItem::execute(KTextEditor::Document* document, const KTextEdi
kDebug() << "completion item for implementation has no parent context!";
}
replText += "/**\n" + indendation + " * ";
replText += "/**\n" + indentation + " * ";
// insert old comment:
const QString indentationWithExtra = "\n" + indendation + " *";
const QString indentationWithExtra = "\n" + indentation + " *";
replText += m_declaration->comment().replace('\n', indentationWithExtra.toAscii().constData());
replText += "\n" + indendation + " * @overload " + m_declaration->internalContext()->scopeIdentifier(true).toString();
replText += "\n" + indendation + " **/\n" + indendation;
replText += "\n" + indentation + " * @overload " + m_declaration->internalContext()->scopeIdentifier(true).toString();
replText += "\n" + indentation + " **/\n" + indentation;
}
#endif
......@@ -248,15 +248,15 @@ void ImplementationItem::execute(KTextEditor::Document* document, const KTextEdi
}
}
replText += QString("\n%1{\n%1 ").arg(indendation);
replText += QString("\n%1{\n%1 ").arg(indentation);
if (isInterface || m_type == ImplementationItem::Implement) {
} else if (!isConstructorOrDestructor && !voidReturnType) {
replText += QString("$ret = parent::%2%3;\n%1 return $ret;").arg(indendation).arg(functionName).arg(arguments);
replText += QString("$ret = parent::%2%3;\n%1 return $ret;").arg(indentation).arg(functionName).arg(arguments);
} else {
replText += QString("parent::%1%2;").arg(functionName).arg(arguments);
}
replText += QString("\n%1}\n%1")
.arg(indendation);
.arg(indentation);
}
......
......@@ -69,7 +69,7 @@ void KeywordItem::execute(KTextEditor::Document* document, const KTextEditor::Ra
{
if ( !m_replacement.isEmpty() ) {
QString replacement = m_replacement;
replacement = replacement.replace('\n', '\n' + getIndendation(document->line(word.start().line())));
replacement = replacement.replace('\n', '\n' + getindentation(document->line(word.start().line())));
replacement = replacement.replace("%INDENT%", indentString(document));
int cursorPos = replacement.indexOf("%CURSOR%");
......
......@@ -33,8 +33,8 @@ class KeywordItem : public NormalDeclarationCompletionItem
{
public:
/// Use @p customReplacement for additional power on how the keyword gets replaced.
/// Newlines will be indendet to the indendation level of the line we execute the item on.
/// To increase an indendation level, use %INDENT%. To place the cursor, use %CURSOR%.
/// Newlines will be indendet to the indentation level of the line we execute the item on.
/// To increase an indentation level, use %INDENT%. To place the cursor, use %CURSOR%.
/// Alternatively you can select a word with %SELECT%word%SELECT%
///
/// NOTE: By default (i.e. when this function never gets called) @p keyword will be used as replacement.
......
......@@ -71,7 +71,7 @@ void DeclarationBuilder::getVariableIdentifier(VariableAst* node,
{
parent = QualifiedIdentifier();
if ( node->variablePropertiesSequence ) {
// at least one "->" in the assigment target
// at least one "->" in the assignment target
// => find he parent of the target
// => find the target (last object property)
if ( node->variablePropertiesSequence->count() == 1 ) {
......@@ -1069,7 +1069,7 @@ void DeclarationBuilder::visitAssignmentExpressionEqual(AssignmentExpressionEqua
declareClassMember(ctx, type, m_findVariable.identifier, m_findVariable.node);
}
} else {
// assigment to other variables
// assignment to other variables
declareVariable(currentContext(), type, m_findVariable.identifier, m_findVariable.node );
}
}
......
......@@ -190,7 +190,7 @@ private:
bool &arrayAccess);
/**
* Declare a class member in @p parentCtx. Validates whether the current context allowes
* Declare a class member in @p parentCtx. Validates whether the current context allows
* redeclaration of private/protected members.
*
* @param parentCtx The class context you want to add the member to.
......
......@@ -524,7 +524,7 @@ void TypeBuilder::visitStatement(StatementAst* node)
if (!classDec) {
///FIXME: this is just a hack for https://bugs.kde.org/show_bug.cgi?id=269369
/// a proper fix needs full fledged two-pass, i.e. get rid of PreDeclarationBuilder
// 0 == global lookup and the delcaration is found again...
// 0 == global lookup and the declaration is found again...
classDec = dynamic_cast<ClassDeclaration*>(type->declaration(0));
}
if (classDec) {
......
......@@ -1247,7 +1247,7 @@ void TestDUChain::functionDocBlock()
}
{
// same as above but with indendation
// same as above but with indentation
TopDUContext* top = parse("<?\n /// Foo\n /// Bar\n function foo() {} ", DumpNone);
DUChainReleaser releaseTop(top);
DUChainWriteLocker lock(DUChain::lock());
......@@ -2522,7 +2522,7 @@ void TestDUChain::useNamespace()
dec = top->localDeclarations().at(4);
QCOMPARE(dec->qualifiedIdentifier().toString(), QString("ns6"));
QVERIFY(dynamic_cast<NamespaceAliasDeclaration*>(dec));
///TODO: find out why this is explictly required
///TODO: find out why this is explicitly required
QVERIFY(!dynamic_cast<NamespaceAliasDeclaration*>(dec)->importIdentifier().explicitlyGlobal());
}
......@@ -2562,7 +2562,7 @@ void TestDUChain::namespacedCatch()
"}\n"
"namespace {\n"
"try { /* ... */ }\n"
"catch(\\ns\\e $exeption) { /* ... */ }"
"catch(\\ns\\e $exception) { /* ... */ }"
"}\n"
, DumpNone);
QVERIFY(top);
......
......@@ -1593,7 +1593,7 @@ QList<CompletionTreeItemPointer> CodeCompletionContext::completionItems(bool& ab
///TODO: function-like statements should just be handled as a function with declaration etc.
/// e.g.: empty, eval, die, exit, isset, unset
/// but _not_ echo, print, catch, include*, require*
///TODO: use user's style for indendation etc.
///TODO: use user's style for indentation etc.
ADD_KEYWORD2("abstract class", "abstract class %SELECT%NAME%ENDSELECT% {\n%INDENT%\n}\n");
ADD_KEYWORD2("final class", "final class %SELECT%NAME%ENDSELECT% {\n%INDENT%\n}\n");
ADD_KEYWORD2("class", "class %SELECT%NAME%ENDSELECT% {\n%INDENT%\n}\n");
......
......@@ -206,7 +206,7 @@ const QString indentString(KTextEditor::Document *document)
return QStringLiteral("\t");
}
QString getIndendation( const QString &line ) {
QString getindentation( const QString &line ) {
return line.left(line.indexOf(QRegExp("\\S"), 0));
}
......
......@@ -60,15 +60,15 @@ QStringList getMethodTokens(QString text);
const QString KDEVPHPCOMPLETION_EXPORT indentString(KTextEditor::Document *document);
/**
* Get the indendation of a given line.
* Get the indentation of a given line.
*
* You usually want to use it with something like the following:
*
* \code
* const QString indendation = getIndendation( document->line(replaceRange.start().line()) );
* const QString indentation = getindentation( document->line(replaceRange.start().line()) );
* \endcode
*/
QString KDEVPHPCOMPLETION_EXPORT getIndendation( const QString &line );
QString KDEVPHPCOMPLETION_EXPORT getindentation( const QString &line );
}
#endif
......
......@@ -120,22 +120,22 @@ void ImplementationItem::execute(KTextEditor::View* view, const KTextEditor::Ran
replaceRange.start() = KTextEditor::Cursor(methodText.count('\n'), methodText.length() - methodText.lastIndexOf('\n') - 1);
}
// get indendation
QString indendation;
// get indentation
QString indentation;
{
QString currentLine = document->line(replaceRange.start().line());
indendation = getIndendation(currentLine);
indentation = getindentation(currentLine);
if ( !currentLine.isEmpty() && currentLine != indendation ) {
if ( !currentLine.isEmpty() && currentLine != indentation ) {
// since theres some non-whitespace in this line, skip to the enxt one
replText += '\n' + indendation;
replText += '\n' + indentation;
}
if (indendation.isEmpty()) {
// use a minimal indendation
if (indentation.isEmpty()) {
// use a minimal indentation
// TODO: respect code style
indendation = QStringLiteral(" ");
replText += indendation;
indentation = QStringLiteral(" ");
replText += indentation;
}
}
......@@ -151,12 +151,12 @@ void ImplementationItem::execute(KTextEditor::View* view, const KTextEditor::Ran
qCDebug(COMPLETION) << "completion item for implementation has no parent context!";
}
replText += "/**\n" + indendation + " * ";
replText += "/**\n" + indentation + " * ";
// insert old comment:
const QString indentationWithExtra = "\n" + indendation + " *";
const QString indentationWithExtra = "\n" + indentation + " *";
replText += m_declaration->comment().replace('\n', indentationWithExtra.toAscii().constData());
replText += "\n" + indendation + " * @overload " + m_declaration->internalContext()->scopeIdentifier(true).toString();
replText += "\n" + indendation + " **/\n" + indendation;
replText += "\n" + indentation + " * @overload " + m_declaration->internalContext()->scopeIdentifier(true).toString();
replText += "\n" + indentation + " **/\n" + indentation;
}
#endif
......@@ -251,15 +251,15 @@ void ImplementationItem::execute(KTextEditor::View* view, const KTextEditor::Ran
}
}
replText += QStringLiteral("\n%1{\n%1 ").arg(indendation);
replText += QStringLiteral("\n%1{\n%1 ").arg(indentation);
if (isInterface || m_type == ImplementationItem::Implement) {
} else if (!isConstructorOrDestructor && !voidReturnType) {
replText += QStringLiteral("$ret = parent::%2%3;\n%1 return $ret;").arg(indendation, functionName, arguments);
replText += QStringLiteral("$ret = parent::%2%3;\n%1 return $ret;").arg(indentation, functionName, arguments);
} else {
replText += QStringLiteral("parent::%1%2;").arg(functionName, arguments);
}
replText += QStringLiteral("\n%1}\n%1")
.arg(indendation);
.arg(indentation);
}
......
......@@ -71,7 +71,7 @@ void KeywordItem::execute(KTextEditor::View* view, const KTextEditor::Range& wor
KTextEditor::Document *document = view->document();
if ( !m_replacement.isEmpty() ) {
QString replacement = m_replacement;
replacement = replacement.replace('\n', '\n' + getIndendation(document->line(word.start().line())));
replacement = replacement.replace('\n', '\n' + getindentation(document->line(word.start().line())));
replacement = replacement.replace(QLatin1String("%INDENT%"), indentString(document));
int cursorPos = replacement.indexOf(QStringLiteral("%CURSOR%"));
......
......@@ -74,7 +74,7 @@ void DeclarationBuilder::getVariableIdentifier(VariableAst* node,
{
parent = QualifiedIdentifier();
if ( node->variablePropertiesSequence ) {
// at least one "->" in the assigment target
// at least one "->" in the assignment target
// => find he parent of the target
// => find the target (last object property)
if ( node->variablePropertiesSequence->count() == 1 ) {
......@@ -1121,7 +1121,7 @@ void DeclarationBuilder::visitAssignmentExpressionEqual(AssignmentExpressionEqua
declareClassMember(ctx, type, m_findVariable.identifier, m_findVariable.node);
}
} else {
// assigment to other variables
// assignment to other variables
declareVariable(currentContext(), type, m_findVariable.identifier, m_findVariable.node );
}
}
......
......@@ -190,7 +190,7 @@ private:
bool &arrayAccess);
/**
* Declare a class member in @p parentCtx. Validates whether the current context allowes
* Declare a class member in @p parentCtx. Validates whether the current context allows
* redeclaration of private/protected members.
*
* @param parentCtx The class context you want to add the member to.
......
......@@ -527,7 +527,7 @@ void TypeBuilder::visitStatement(StatementAst* node)
if (!classDec) {
///FIXME: this is just a hack for https://bugs.kde.org/show_bug.cgi?id=269369
/// a proper fix needs full fledged two-pass, i.e. get rid of PreDeclarationBuilder
// 0 == global lookup and the delcaration is found again...
// 0 == global lookup and the declaration is found again...
classDec = dynamic_cast<ClassDeclaration*>(type->declaration(0));
}
if (classDec) {
......
......@@ -1274,7 +1274,7 @@ void TestDUChain::functionDocBlock()
}
{
// same as above but with indendation
// same as above but with indentation
TopDUContext* top = parse("<?\n /// Foo\n /// Bar\n function foo() {} ", DumpNone);
DUChainReleaser releaseTop(top);
DUChainWriteLocker lock(DUChain::lock());
......@@ -2549,7 +2549,7 @@ void TestDUChain::useNamespace()
dec = top->localDeclarations().at(4);
QCOMPARE(dec->qualifiedIdentifier().toString(), QString("ns6"));
QVERIFY(dynamic_cast<NamespaceAliasDeclaration*>(dec));
///TODO: find out why this is explictly required
///TODO: find out why this is explicitly required
QVERIFY(!dynamic_cast<NamespaceAliasDeclaration*>(dec)->importIdentifier().explicitlyGlobal());
}
......@@ -2589,7 +2589,7 @@ void TestDUChain::namespacedCatch()
"}\n"
"namespace {\n"
"try { /* ... */ }\n"
"catch(\\ns\\e $exeption) { /* ... */ }"
"catch(\\ns\\e $exception) { /* ... */ }"
"}\n"
, DumpNone);
QVERIFY(top);
......
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