Introduces ITextEditorDocument. This is part of a more general "use
documents instead of editors whereever possible". It will allow to move
to e.g. ITextEditor::openedTextDocumentContents() instead of
ITextEditor::openedTextEditorsContents().
Change-Id: I5ebceaa257a0d2c3e8ac4ac51b9b08b6faa42487
Reviewed-by: David Schulz <david.schulz@digia.com>
Simplifies code and makes it independent from mimetype names.
Change-Id: Ib56a07654df4986b1916c517e3862e6c3a3dd720
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Ran script to remove inludes on a trial-and-error basis and
manually corrected it.
Change-Id: Ic8464ea084ca1ab401e9f4a7d0183b92b4038902
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
... and adjust INCLUDEPATH accordingly.
while i'm at messing with include statements, also re-order the include
blocks according to policy and sort them within bigger blocks.
Change-Id: I7762abfd7c4ecf59432b99db2f424e4fa25733a5
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Steps to reproduce the crash:
1. Open some long file, e.g. botan.cpp
2. Trigger completion and close editor immediately
The IDocument pointer was only used to reference the file name. Instead
of passing an IDocument* to the IAssistInterface, pass the file name.
Change-Id: Iafce9b818806a77968a10541114bc9b7c8665f11
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
argumentCount is a more expensive function, so try to call it only once,
esp. in loops.
Change-Id: I6f0d420352743ec444487ce3f506ef28e5282d1e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reduce the padding in some often-used structs for 64bit machines.
32bit machines should also profit from most changes, but to a
lesser degree.
Change-Id: Ic4c67b94e962731de4f31164c52a372d78944ccc
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
No need to create local variables for pointers
which are used just once.
Change-Id: If917689019ac1319b9f9d3aee8fa15ec5a34d751
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This was the indirect cause for "random" freezes when using
code-completion. The direct cause was a while loop counting down to 0,
but starting with a negative value. Both are fixed now.
Task-number: QTCREATORBUG-8472
Task-number: QTCREATORBUG-8532
Change-Id: I782a46be3ac8282d7484d0bf0c6fd30be6b171c8
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
#!/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>
For example locals and function argument names appear early whereas
macros and keywords are way down. That should move helpful
items to the top of the list.
Change-Id: Ibcfe973ebbac2e3bce9cafbe14dc4c71430ddca7
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* You now get completion for std::vector<int>::[complete].
* Also added a test.
Conflicts:
src/plugins/cpptools/cppcompletion_test.cpp
src/plugins/cpptools/cpptoolsplugin.h
Change-Id: I596ebf6bd18ec9a347113f8d162cc124c8a0d6b4
Reviewed-by: hjk <qthjk@ovi.com>
Could be reproduced in code as below (cursor at |):
QFormLayout|formLayout *fl = new QFormLayout(this);
Change-Id: I7f5e9ac8ff8dfffbca63d7ab9f837333440c9810
Reviewed-by: hjk <qthjk@ovi.com>
This rewrite fixes a couple of issues with the pre-processor. It now
supports:
- macros in macro bodies
- stringification of parameters [cpp.stringize]
- the concatenation operator [cpp.concat]
- #include MACRO_HERE
- defined() inside macro bodies used in pp-conditions.
Change-Id: Ifdb78041fb6afadf44f939a4bd66ce2832b8601f
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
When completing function name, scan text backwards to find if we are
trying to dereference the function.
Change-Id: I32cabecb651ff35d949600d9fdeb61c8e68ae98f
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
And adapt the other API respectively.
Change-Id: I1e04e555409be09242db6890f9e013396f83aeed
Reviewed-by: Bill King <bill.king@nokia.com>
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
Getting the #include directives ready for Qt5. This includes the
new-project wizards.
Change-Id: Ia9261f1e8faec06b9285b694d2b7e9a095978d2b
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
Now IGenericProposalModel::isSortable also takes the current prefix
as a parameter. This is particularly useful for cases like in the C++
completion: For global completions it will only sort if there's
already a content prefix - Notice, however, that the "sorting threshold"
for a maximum number of items is still kept in IGenericProposalModel::sort.
Task-number: QTCREATORBUG-6404
Change-Id: I3c2f282aa565287b8b4989930b6a27093862ef25
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Continuinng a previous commit... This is in order to make
the interface clearer.
Change-Id: Ic1b05217f878578bc84a064927507b75981c47d6
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
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>
Avoid inserting characters that are already there.
e.g.
int testFly() {}
te|Fly()
When triggers a completion, the code will changed to:
testFly()|
But in before, the code will changed to:
testFly()|Fly()
Notice: Character of '|' show the cursor position.
Change-Id: I6c111e30356b2549aebc6fbea05608e70d6ab41f
Merge-request: 398
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
In the old code completion engine items were created on the stack
and passed around by value. With the refactoring of the code assist
API they became heap objects manipulated through pointers. This
patch fixes one reminiscence not caught during the refactoring
in which the same actual pointer was being used more than once to
be appended on the list.
Change-Id: I2009fb0b6aa18df57aa5ca9bde0591536ca2cd74
Reviewed-on: http://codereview.qt-project.org/4444
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>