summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/qmljscodeformatter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Clean headers in QmlJs.Friedemann Kleint2013-04-041-1/+0
| | | | | | | | Ran script to remove inludes on a trial-and-error basis and manually corrected it (Parser excluded). Change-Id: I5ec6e1076430009bb72094411b2c3386f8bea548 Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
* Merge remote-tracking branch 'origin/2.6'Oswald Buddenhagen2013-01-311-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in src/plugins/debugger/qtmessageloghandler.cpp src/plugins/debugger/qtmessagelogwindow.cpp src/plugins/madde/maemodeployconfigurationwidget.cpp src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp src/plugins/qmldesigner/designercore/include/widgetqueryview.h src/plugins/qmldesigner/designercore/metainfo/metainfoparser.cpp src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp src/plugins/qnx/bardescriptormagicmatcher.h src/plugins/qt4projectmanager/profilekeywords.cpp src/plugins/remotelinux/deployablefilesperprofile.cpp src/plugins/remotelinux/deployablefilesperprofile.h src/plugins/remotelinux/deploymentinfo.cpp src/plugins/remotelinux/deploymentsettingsassistant.cpp src/plugins/remotelinux/profilesupdatedialog.cpp tests/auto/icheckbuild/ichecklib.cpp tests/auto/icheckbuild/parsemanager.cpp tests/auto/icheckbuild/parsemanager.h Change-Id: Ie465a578446a089e1c502d1cb1096e84ca058104
| * Incremented year in copyright infov2.6.2Robert Loehning2013-01-291-1/+1
| | | | | | | | | | Change-Id: Ic6a9ff0359625021ebc061d22db6811814534205 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* | Remove braces for single lines of conditionsOrgad Shaneh2013-01-081-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #!/usr/bin/env ruby Dir.glob('**/*.cpp') { |file| # skip ast (excluding paste, astpath, and canv'ast'imer) next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i s = File.read(file) next if s.include?('qlalr') orig = s.dup s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m| res = $& if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces res else res.gsub!('} else', 'else') res.gsub!(/\n +} *\n/m, "\n") res.gsub(/ *{$/, '') end } s.gsub!(/ *$/, '') File.open(file, 'wb').write(s) if s != orig } Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc Reviewed-by: hjk <qthjk@ovi.com>
* | qmljs: indent expression in if condition and indent lambda expressionsFawzi Mohamed2012-12-031-9/+2
| | | | | | | | | | | | | | | | | | * indent expressions (like function defs) in if condition fixes QTCREATORBUG-7243 Change-Id: I61197317a8dcba72a45b660600711748e2e2b962 Reviewed-by: Christian Kamm <kamm@incasoftware.de> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* | QmlJS: Revert CodeFormatter::stateToString return type to QStringOrgad Shaneh2012-11-281-2/+2
| | | | | | | | | | | | Change-Id: I532327126dfdbe4d338d7afd0bcbe5e27ba206d9 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* | Fix: build failure for qmljscheck an qmljscodeformatterDavid Schulz2012-11-281-9/+9
| | | | | | | | | | Change-Id: Iba9686506d971f92e525361e93d648dc940fe2d2 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* | QmlJS: Compile with QT_NO_CAST_FROM_ASCIIOrgad Shaneh2012-11-281-5/+5
|/ | | | | | Change-Id: I0c5654a978f47a4db5428936fd44633f21394830 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
* Adjust license headershjk2012-10-051-21/+20
| | | | | Change-Id: Ice592c6de9951ee3b2c4cb52ed0bb3b6770e0825 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* QmlJS indenter: Fix wrong indentation after list<> typed properties.Christian Kamm2012-09-101-4/+4
| | | | | | Task-number: QTCREATORBUG-7726 Change-Id: If709a9a71cfed69e2f14af92c114f79d11d03145 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
* Contact -> qt-project.orgEike Ziller2012-07-191-3/+1
| | | | | Change-Id: I7134d7de30bcf9f9dcfad42520dd45ee083a852d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QmlJS indenter: Improve indentation of function expressions.Christian Kamm2012-03-061-20/+3
| | | | | | | | | As discussed with Tor Arne and Fawzi in http://codereview.qt-project.org/#change,18080 Change-Id: Ia0482d2ed3ddd61fa002e2c76b948301af52a795 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@nokia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* QmlJS indenter: Improve handling of function expressions.Christian Kamm2012-03-011-8/+17
| | | | | | | | | Task-number: QTCREATORBUG-7001 Change-Id: I254b84153b042c81008314bbebc800edfe201b89 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@nokia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com> (cherry picked from commit fcaf3d4f4c515e9c552357156d0a48b2c8359984)
* QmlJS indenter: Fix hang with invalid code.Robert Loehning2012-03-011-3/+13
| | | | | | | | | Task-number: QTCREATORBUG-7005 (cherry picked from commit 0c597a6f070ebd434d93cc4052f8445e4ba434dc) Change-Id: I2e343fbcc6931530e7db142bf6e268dac696970f Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
* Removed module names from #include directives.Erik Verbruggen2012-02-151-5/+5
| | | | | | | | Getting the #include directives ready for Qt5. This includes the new-project wizards. Change-Id: Ia9261f1e8faec06b9285b694d2b7e9a095978d2b Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
* Long live the king!hjk2012-01-261-1/+1
| | | | | Change-Id: I2b72b34c0cfeafc8bdbaf49b83ff723544f2b6e2 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
* QmlJS indenter: Fix braceless switch/try/with bindings.Christian Kamm2011-12-021-28/+56
| | | | | Change-Id: Iee25f3f9ec38b1b7fc2697f390386c9a60cb8347 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* QmlJS indenter: Fix indent after do-while without semicolon.Christian Kamm2011-11-151-1/+2
| | | | | Change-Id: I4909f4640e7cd115b6c5c54c7aca7fca511653c9 Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
* Merge remote-tracking branch 'origin/2.4'Eike Ziller2011-11-111-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/libs/qmljs/qmljsinterpreter.cpp src/libs/qmljs/qmljsinterpreter.h src/plugins/debugger/qml/scriptconsole.cpp src/plugins/git/gitplugin.cpp src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas.cpp src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h Change-Id: Iad59c8d87c72a21c79c047e374c0ab689998af39
| * all: s/info@qt.nokia.com/qt-info@nokia.com/hjk2011-11-031-2/+2
| | | | | | | | | | Change-Id: If18afb5d4665924e7d9250dccbc60a65e6daa75e Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
* | Merge remote-tracking branch 'origin/2.4'Eike Ziller2011-11-011-7/+12
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/libs/qmljs/qmljsinterpreter.cpp src/libs/qmljs/qmljsinterpreter.h src/plugins/madde/maemopackagecreationstep.cpp src/plugins/projectexplorer/buildmanager.cpp src/plugins/qmljstools/qmljsqtstylecodeformatter.cpp src/plugins/qmljstools/qmljsqtstylecodeformatter.h tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp Change-Id: I63ab2ba5dac006c37ccfbae55b023396a4676ff7
| * QmlJS indenter: Never touch indent of multi-line strings.Christian Kamm2011-10-311-4/+5
| | | | | | | | | | | | Task-number: QTCREATORBUG-6368 Change-Id: Iae68427e429e625214bc0729aaaf313dc3371570 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS indenter: Fix hang when using 'else (a==a) {}'.Christian Kamm2011-10-191-2/+8
| | | | | | | | | | Change-Id: Id7b8fba6707b1eaabf8065854f357cf600c809c5 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
* | QmlJS indenter: Improve indentation of function literals.Christian Kamm2011-10-191-0/+4
| | | | | | | | | | Change-Id: Ic79745eefbf37e42d4dd42e73d3752bed34bbfa9 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS indenter: Move reusable code to qmljs lib.Christian Kamm2011-10-191-0/+317
| | | | | | | | | | Change-Id: I5ab50b586109a9736cda48245807571ce10dfb5b Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | Merge remote-tracking branch 'origin/2.4'Eike Ziller2011-10-171-13/+10
|\ \ | |/ | | | | | | | | | | | | | | Conflicts: qtcreator.pri src/libs/qmljs/qmljstypedescriptionreader.cpp tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp Change-Id: Id032187023bb42f259a87545ceeb3c965dd01a32
| * QmlJS indenter: Fix ternary multiline indent.Christian Kamm2011-10-171-13/+10
| | | | | | | | | | | | Task-number: QTCREATORBUG-6208 Change-Id: I7e5267291bc01226b5339cb4abdbb15856c58477 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
* | Json: Fix indenter for json files.Christian Kamm2011-10-121-0/+1
|/ | | | | | | Change-Id: Id864509dd78a70fc34a3798b80f7e1c8991181f4 Reviewed-on: http://codereview.qt-project.org/6038 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* QmlJS indenter: Fix labelled statements and break/continue with label.Christian Kamm2011-09-141-3/+31
| | | | | | | | Also do some cleanup to make handling of substatements nicer. Change-Id: I78773fc81d9b0058fa97c5cef393cca34b7fd885 Reviewed-on: http://codereview.qt-project.org/4413 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
* QmlJS indenter: Fix indentation for property initializers.Christian Kamm2011-09-081-16/+1
| | | | | | | | | | property int foo: { used to start an object literal but is a block statement now. Change-Id: I9ffbce4927b444314f1a43aba65ca3d9d234e47c Reviewed-on: http://codereview.qt-project.org/4339 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* QmlJS: Fix uses of Scanner::state().Christian Kamm2011-06-031-2/+2
| | | | | | | Change-Id: I5195fc43e8a6653bf52c0eaa6cddb8dfd25b6217 Reviewed-on: http://codereview.qt.nokia.com/319 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Make C++ code style configurable.Christian Kamm2011-05-241-1/+2
| | | | | | | | | | | | | | Change-Id: Iaf08edb2361146e6b5e1cbafdb716a23c938875b Done-with: Jarek Kobus Task-number: QTCREATORBUG-2670 Task-number: QTCREATORBUG-4310 Task-number: QTCREATORBUG-2763 Task-number: QTCREATORBUG-3623 Task-number: QTCREATORBUG-567 Reviewed-on: http://codereview.qt.nokia.com/74 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Fix/add copyright headersTobias Hunger2011-05-061-1/+1
| | | | Change-Id: I8b73d583be1ee7183f4074bce49d5390e38631a2
* QmlJS: Fix object literal indent in property initializers.Christian Kamm2011-04-211-2/+17
|
* QmlJS: Fix indent of object literals.Christian Kamm2011-04-211-2/+19
| | | | Reviewed-by: Roberto Raggi
* Fix more krazy warnings.Friedemann Kleint2011-04-191-1/+1
|
* Update license.hjk2011-04-131-14/+13
|
* QmlJS indenter: Fix object bindings with namespaces.Christian Kamm2011-01-201-1/+3
| | | | | Task-number: QTCREATORBUG-3371 Reviewed-by: Roberto Raggi
* It's 2011 now.con2011-01-121-1/+1
| | | | Reviewed-by: hjk
* QmlJS indenter: Only auto-reindent if indent was unchanged.Christian Kamm2011-01-041-0/+12
| | | | | | | | | | This change in how electric characters are handled has gone into the C++ indenter a while ago and works well there. It means Creator is less likely to annoyingly change the indent on lines where the indentation whas changed manually. It is still possible to trigger a reindent manually. Reviewed-by: Erik Verbruggen
* Merge branch '2.1'con2010-12-171-7/+11
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/coreplugin/basemode.cpp src/plugins/coreplugin/basemode.h src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h src/plugins/debugger/cdb/cdbsymbolpathlisteditor.cpp src/plugins/debugger/debuggeragents.cpp src/plugins/debugger/debuggeruiswitcher.cpp src/plugins/debugger/debuggeruiswitcher.h src/plugins/projectexplorer/buildconfigdialog.cpp src/plugins/qmldesigner/components/propertyeditor/colorwidget.cpp src/plugins/qmldesigner/components/propertyeditor/colorwidget.h src/plugins/qmldesigner/designercore/include/enumeratormetainfo.h src/plugins/qmldesigner/designercore/include/modelutilities.h src/plugins/qmldesigner/designercore/include/nodeinstance.h src/plugins/qmldesigner/designercore/include/propertymetainfo.h src/plugins/qmldesigner/designercore/instances/graphicsscenenodeinstance.cpp src/plugins/qmldesigner/designercore/instances/graphicsscenenodeinstance.h src/plugins/qmldesigner/designercore/instances/graphicsviewnodeinstance.cpp src/plugins/qmldesigner/designercore/instances/graphicswidgetnodeinstance.cpp src/plugins/qmldesigner/designercore/instances/graphicswidgetnodeinstance.h src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp src/plugins/qmldesigner/designercore/instances/qmlviewnodeinstance.cpp src/plugins/qmldesigner/designercore/instances/widgetnodeinstance.cpp src/plugins/qmldesigner/designercore/instances/widgetnodeinstance.h src/plugins/qmldesigner/designercore/metainfo/enumeratormetainfo.cpp src/plugins/qmldesigner/designercore/metainfo/propertymetainfo.cpp src/plugins/qmldesigner/designercore/model/modelutilities.cpp src/plugins/snippets/inputwidget.cpp src/plugins/snippets/snippetscompletion.cpp src/plugins/snippets/snippetscompletion.h src/plugins/snippets/snippetspec.cpp src/plugins/snippets/snippetsplugin.cpp src/plugins/snippets/snippetswindow.cpp src/plugins/snippets/snippetswindow.h src/plugins/texteditor/snippetsparser.cpp src/tools/qml/qmldom/main.cpp tests/manual/trk/runner.cpp tests/manual/trk/trkolddevice.cpp tests/manual/trk/trkolddevice.h tests/manual/trk/trkserver.cpp
| * License headers.con2010-12-171-7/+11
| |
* | QmlJS indenter: Fix for expressions starting with numbers or strings.Christian Kamm2010-12-091-0/+2
|/ | | | Reviewed-by: Roberto Raggi
* QmlJS indenter: Fix incorrect indent after break/continue.Christian Kamm2010-09-301-0/+1
| | | | | | | Make sure to push a transitory state before leave(true) so it only finishes the statement - and not the surrounding statement! Reviewed-by: trustme
* QmlJS indenter: Fix break/continue/throw in if statement without braces.Christian Kamm2010-09-271-0/+8
| | | | Reviewed-by: Roberto Raggi
* QmlJS indenter: Fix problem with object literals.Christian Kamm2010-09-271-1/+10
| | | | Reviewed-by: Roberto Raggi
* QmlJS: Introduce a new indenter that works similarly to the new C++ one.Christian Kamm2010-08-101-0/+910
Done-with: Thomas Hartmann