Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
90a44ab1
Commit
90a44ab1
authored
Jan 20, 2011
by
Christian Kamm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QmlJS indenter: Fix object bindings with namespaces.
Task-number: QTCREATORBUG-3371 Reviewed-by: Roberto Raggi
parent
ca73b6b9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
src/libs/qmljs/qmljscodeformatter.cpp
src/libs/qmljs/qmljscodeformatter.cpp
+3
-1
tests/auto/qml/qmleditor/qmlcodeformatter/qmlcodeformatter.pro
.../auto/qml/qmleditor/qmlcodeformatter/qmlcodeformatter.pro
+1
-0
tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp
...o/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp
+14
-0
No files found.
src/libs/qmljs/qmljscodeformatter.cpp
View file @
90a44ab1
...
...
@@ -246,8 +246,10 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
case
expression_or_objectdefinition
:
switch
(
kind
)
{
case
Dot
:
case
Identifier
:
break
;
// need to become an objectdefinition_open in cases like "width: Qt.Foo {"
case
LeftBrace
:
turnInto
(
objectdefinition_open
);
break
;
default:
enter
(
expression
);
continue
;
// really?
first token
already gone
!
default:
enter
(
expression
);
continue
;
// really?
identifier and more tokens might
already
be
gone
}
break
;
case
expression
:
...
...
tests/auto/qml/qmleditor/qmlcodeformatter/qmlcodeformatter.pro
View file @
90a44ab1
...
...
@@ -8,6 +8,7 @@ SRCDIR = ../../../../../src
#
include
(
$$
SRCDIR
/../
qtcreator
.
pri
)
include
(
$$
SRCDIR
/
libs
/
qmljs
/
qmljs
-
lib
.
pri
)
include
(
$$
SRCDIR
/
libs
/
utils
/
utils
-
lib
.
pri
)
include
(
$$
SRCDIR
/
libs
/
languageutils
/
languageutils
-
lib
.
pri
)
#
LIBS
+=
-
L
$$
IDE_LIBRARY_PATH
SOURCES
+=
\
...
...
tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp
View file @
90a44ab1
...
...
@@ -53,6 +53,7 @@ private Q_SLOTS:
void
expressionContinuation
();
void
objectLiteral
();
void
keywordStatement
();
void
namespacedObjects
();
};
struct
Line
{
...
...
@@ -961,6 +962,19 @@ void tst_QMLCodeFormatter::keywordStatement()
checkIndent
(
data
);
}
void
tst_QMLCodeFormatter
::
namespacedObjects
()
{
QList
<
Line
>
data
;
data
<<
Line
(
"Item {"
)
<<
Line
(
" width: Q.Foo {"
)
<<
Line
(
" Q.Bar {"
)
<<
Line
(
" x: 12"
)
<<
Line
(
" }"
)
<<
Line
(
" }"
)
;
checkIndent
(
data
);
}
QTEST_APPLESS_MAIN
(
tst_QMLCodeFormatter
)
#include "tst_qmlcodeformatter.moc"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment