Commit Graph

95 Commits

Author SHA1 Message Date
Leandro Melo
466ea4842c C++: Improve file accuracy when finding symbols
This patch introduces a priority-based mechanism when searching for certains
symbols in the snapshot. The priority corresponds to how similar the file path
from the "reference" symbol is to the file path from the "candidate" symbol.
This solves a variety of issues when matching "equivalent" symbols but that
are in another file/project, such as when following a function declaration,
a forward class declaration, or adding a definition through a quickfix.

There's now a symbol finder which will compute the "best" search order and cache
the most recent results. A consequence is that following symbols in some cases
is slower, but not apparently significatly.

Note: The "find" functions were moved from the Snapshot to the new SymbolFinder
class.

Task-number: QTCREATORBUG-6697
Task-number: QTCREATORBUG-6792

Change-Id: Ia518f014275fec1f4d0cb3224bd4e06a9df6d557
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-01-23 11:34:44 +01:00
Leandro Melo
fd179ed951 C++: Accept UTF-8 byte arrays in type of expression
The model uses UTF-8 internally and it makes more sense to only
convert when necessary.

A following commit will rename the source/setSource methods in
document for more clarity too.

Change-Id: I960ea0754efabd1436ad4b4299a57faeb65a8bee
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-01-13 10:17:03 +01:00
Friedemann Kleint
9128fc2ab0 CppEditor: Compile with QT_NO_CAST_FROM_ASCII.
- Avoid unnecessary conversions
- Add missing tr().

Change-Id: I3c0dd627a3621929c9c6fc71db6924fa513e34a7
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2012-01-12 13:50:30 +01:00
Leandro Melo
c25f0585d1 C++: Extract function quickfix
Task-number: QTCREATORBUG-5485

Change-Id: Ib6aaeaadad4b421480d22399392768d4bad85bda
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-01-10 15:31:03 +01:00
Friedemann Kleint
30374e2bb1 CppEditor: Improve string literal quick fix.
- Add conversion for single character constants, offering
  to convert them characters or QLatin1Char.
- Offer conversions from character constants to string constants.
- Rewrite the WrapStringLiteral::Operation class such that it
  takes a mask of actions to perform which can be combined
  in arbitrary ways. Provide static convenience functions
  that can be used for the Translation/Objective C conversion
  as well.
- Move code outside class to reduce indentation.
- Use its functionality for the Translation/Objective C
  conversion as well, reducing redundant analysis/operation code.

Change-Id: If32c16a705cfc1cc20a48ab1c93b5053467d1749
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2011-12-18 11:56:35 +01:00
Christian Kamm
dc72cff71a C++: Add basic 'insert #include' quick fix.
Change-Id: I3a2fef56d6d1871ea4bbb139f9bdd2bc44dd0123
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2011-12-02 13:00:28 +01:00
Eike Ziller
85cf2b661e Merge remote-tracking branch 'origin/2.4'
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
2011-11-11 09:46:25 +01:00
hjk
31600758de all: s/info@qt.nokia.com/qt-info@nokia.com/
Change-Id: If18afb5d4665924e7d9250dccbc60a65e6daa75e
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
2011-11-03 10:33:19 +01:00
Christian Kandeler
6820f22bbd CppTools: Remove function replicating standard library functionality.
Change-Id: I0778aa3d91d8c62fcce7e07e2ceffa1970281ec6
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-10-25 15:14:52 +02:00
Leandro Melo
87943ca61c C++: Fix hexadecimals in quick fix
Task-number: QTCREATORBUG-6240
Change-Id: Id3dc48d47f88017b3bc9e026c8e5552d2e9f4d48
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-10-12 14:44:27 +02:00
Friedemann Kleint
1b5e10e1b6 CppEditor: Add Quickfix for Qt 5 QStringLiteral.
Make replacement a parameter of the Operation class.

Change-Id: Ie9c013061d7045b3ee8c0e569e9df342dab38096
Reviewed-on: http://codereview.qt-project.org/5845
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-09-30 12:01:33 +02:00
Christian Kamm
e99f915623 C++: Trigger function signature change via quick fix.
This way we don't need to override Return and Escape.

Change-Id: I1548118c06ee7338ba3dd9d84b82b9314ab16782
Reviewed-on: http://codereview.qt.nokia.com/4183
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-05 12:14:27 +02:00
Christian Kamm
8a6d767a8f Refactoring changes: Cleanup and improvements.
Previously RefactoringFiles were usually passed around by value.
However, since a RefactoringFile may sometimes own a QTextDocument
(when it was read from a file), that's not great and caused the
file to be reread after every copy.

With this change RefactoringFile becomes noncopyable and is always
owned by a shared pointer.

This change also allowed having const RefactoringFiles which is
useful because they can be safely used from other threads. See
CppRefactoringChanges::fileNoEditor.

Change-Id: I9045921d6d0f6349f9558ff2a3d8317ea172193b
Reviewed-on: http://codereview.qt.nokia.com/3084
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-08-19 11:12:09 +02:00
Christian Kamm
077f503958 C++: Use minimal names in 'insert local declaration' quickfix.
Change-Id: Ia8362bc9a4b319ab4bb65f3fb1a36dc769e28ccd
Reviewed-on: http://codereview.qt.nokia.com/2953
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
2011-08-15 13:16:02 +02:00
Leandro Melo
bec4f02495 New code assist API
This is a re-work of our completion engine. Primary goals are:

- Allow the computation to run in a separate thread so the GUI is not locked.
- Support a model-based approach. QStrings are still needed (filtering, etc), but
internal structures are free to use more efficient representations.
- Unifiy all kinds of *assist* into a more reusable and extensible framework.
- Remove unnecessary dependencies on the text editor so we have more generic
and easily "plugable" components (still things to be resolved).
2011-05-18 10:46:20 +02:00
hjk
769b21b49d cppeditor: fix crash on uninitialized pointer
Reviewed-by: Erik Verbruggen
2011-05-11 14:42:16 +02:00
Tobias Hunger
aa2acec14c Fix/add copyright headers
Change-Id: I8b73d583be1ee7183f4074bce49d5390e38631a2
2011-05-06 15:17:05 +02:00
Oswald Buddenhagen
9beb7afbe8 GUI style fixes: spaces before ellipses and excess ellipses 2011-04-18 14:10:11 +02:00
hjk
8397663964 Update license. 2011-04-13 11:49:28 +02:00
hjk
f576ad9f2c texteditor: merge ITextEditable into ITextEditor
rename BastTextEditor->BaseTextEditorWidget, BaseTextEditorEditable->BaseTextEditor
rename BaseTextEditor{,Widget} subclasses
rename editableInterface->editorInterface
rename createEditableInterface->createEditor
minor cleanups after renamings
2011-02-22 11:23:53 +01:00
Friedemann Kleint
a9a5e3ea17 Exported header cleanup. 2011-01-20 14:03:07 +01:00
con
d1023c7614 It's 2011 now.
Reviewed-by: hjk
2011-01-12 09:46:24 +01:00
Erik Verbruggen
f9548e5d13 Added activates-on to the quick-fixes.
Reviewed-by: Christian Kamm
2011-01-10 10:10:54 +01:00
Christian Kamm
20aeec7305 QuickFix: Add comments to undocumented fixes.
Reviewed-by: Erik Verbruggen
2011-01-07 14:49:34 +01:00
con
b1bcf081d8 Merge branch '2.1'
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
2010-12-17 17:00:53 +01:00
con
04e32b0049 License headers. 2010-12-17 16:03:42 +01:00
Christian Kamm
bc3c51f4cf C++: Add quick fix for Q_PROPERTY.
At the moment, it inserts implementations inline.

Done-with: Leandro Melo
2010-12-10 15:43:42 +01:00
Erik Verbruggen
0762e4f8d9 CPPEditor: fix corner cases for complete-switch-statement quick-fix.
The condition resolving now looks through typedefs and calls.

Task-number: QTCREATORBUG-2051
Reviewed-by: Christian Kamm
2010-11-18 14:53:42 +01:00
Friedemann Kleint
0ad2d077b9 Exported header cleanup: Separate out CppQuickFixCollector. 2010-11-01 17:04:48 +01:00
Erik Verbruggen
7334ed9ec4 C++: fixed translatable quick-fix strings. 2010-10-08 13:15:21 +02:00
Erik Verbruggen
3ebc328498 C++: added quickfix to insert a method definition.
Reviewed-by: Christian Kamm
2010-09-30 12:19:39 +02:00
Erik Verbruggen
91208c827f C++: Disabled CompleteSwitchCaseStatement: needs bugfixing.
(cherry picked from commit 3ff803d7e2543b64358755702d3c74318bc01736)
2010-09-27 19:07:04 +02:00
Erik Verbruggen
9a00b8ba27 C++: Renamed cppdeclfromdef.{cpp,h} to cppinsertdecldef.{cpp,h} 2010-09-09 15:26:43 +02:00
Roberto Raggi
081e31fc8c Check for 0x0 pointers. 2010-09-03 16:44:33 +02:00
Roberto Raggi
c12866a467 Merge CPlusPlus::NameId and CPlusPlus::Identifier. 2010-09-02 12:51:01 +02:00
Jarek Kobus
c072293ef0 Typos spotted while translating 2010-08-19 14:06:50 +02:00
Roberto Raggi
2d683cd2c3 Renamed DeclaratorAST::equals_token 2010-08-16 11:38:34 +02:00
Christian Kamm
7a5df3c39d QuickFix: Move helpers from QuickFixData to RefactoringFile.
Makes them easy to use everywhere. Also when calling
QuickFixData::textOf and friends, it wasn't really clear which file
they would run on.
2010-08-13 12:51:22 +02:00
Christian Kamm
bbe64796a0 QuickFix: Introduce CppRefactoringFile. 2010-08-13 12:51:22 +02:00
Christian Kamm
0355e37e53 QuickFix: Migrate to a nicer API for cross-file quick fixes. 2010-08-12 14:21:35 +02:00
Christian Kamm
ca5076e5ae QuickFix: Don't separate createChanges from perform.
This will allow a more efficient and direct implementation.
2010-08-12 14:21:35 +02:00
Roberto Raggi
41b4af0501 Get rid of the prefix findOrInsert for the functions in CPlusPlus::Control. 2010-08-11 15:25:19 +02:00
Roberto Raggi
6324bf4460 Introduced IdExpressionAST. 2010-08-02 12:52:12 +02:00
Erik Verbruggen
b2659950e2 Added the InsertionPointLocator.
For answers to questions about where to insert a snippet/chunk of C++ code. Ok,
currently it will only find the One And Only place to insert method
declarations in classes, and it will need some tuning.
2010-07-27 15:32:40 +02:00
Erik Verbruggen
d980e37e24 Reworked the QuickFix infrastructure. 2010-07-26 13:07:19 +02:00