The generic highlighter and the python editor explicitly map some tokens
to the format C_TEXT. Unfortunately this format is special, because it's
foreground and background colors are handled by setting the editor's
palette, and should not be used for setting the format on characters.
If the format is explicitly set on characters, their background will be
oblique and overpaint e.g. the highlight for the current line, which
looks pretty ugly.
Handle this directly in SyntaxHighlighter::formatForCategory for all
syntax highlighters, by returning an empty QTextCharFormat for C_TEXT.
Change-Id: Ifaeb556754ca8106ad6e55d7062b13b45457a809
Reviewed-by: David Schulz <david.schulz@qt.io>
The syntax highligher is connected to the content changes of the text
editor which is not very useful if the diagnostics been provided by
an asynchronous mechanism. So we add a setter to disconnect the changes
from the syntax highlighter.
Change-Id: Ied4b5fe34000b13bafb1aa177b89befe6620d4d7
Reviewed-by: David Schulz <david.schulz@qt.io>
The backslash itself is not a token, so we must make sure to only format
the trailing whitespace characters as visual whitespace, instead of
everything trailing.
Broke in a92694596e
Task-number: QTCREATORBUG-987
Change-Id: I4e9e84d29513ea317d7e3bde6c6b4c43749cb649
Reviewed-by: David Schulz <david.schulz@qt.io>
Move function which formats all non-whitespace with a given format, and
all whitespace in the same range with correct whitespace highlighting
(merged with the non-whitespace format), from CppHighlighter to
SyntaxHighligher.
Change-Id: I8cac306f6362e804698068a0df0292f88726264f
Reviewed-by: David Schulz <david.schulz@qt.io>
Pass the mapping from custom enum to text style in form of a function,
which then can use a switch which is checked by compilers, and
avoids the need to lookup a different enum somewhere else to find
out what the mapping actually is.
That mapping is cached to keep performance as before.
Also, most highlighters created an enum just for the purpose of mapping
to text styles, basically creating duplicated subsets of text style like
enums everywhere. Instead provide a default, identity mapping from text
styles to text styles.
Change-Id: I2ea1ca702b99e36b8742dfda510b1b2753f0a1c2
Reviewed-by: David Schulz <david.schulz@qt.io>
Mostly done using the following ruby script:
Dir.glob('**/*.cpp').each { |file|
next if file =~ %r{src/shared/qbs|/qmljs/}
s = File.read(file)
s.scan(/^using namespace (.*);$/) {
ns = $1
t = s.gsub(/^(.*)\b#{ns}::((?!Const)[A-Z])/) { |m|
before = $1
char = $2
if before =~ /"|\/\/|\\|using|SIGNAL|SLOT|Q_/
m
else
before + char
end
}
if t != s
puts file
File.open(file, 'w').write(t)
end
}
}
Change-Id: Ief087658e2adc337ee02c49f0fb406597114df07
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
No need for the third construction way if that's not
really used by the factories anyway.
Change-Id: Id3b34da5b0320babae9bef96a79bbaa52e0db06d
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
That avoids a complete reparse of the document when font settings
change, but in turn now requires an explicit redo of semantic
highlighting in that case.
The cpp editor part of this patch is actually still doing semantic
parsing though. This will be fixed up in a later patch.
Change-Id: I6f51a18cba6325856c96e155700eb912f6d3aad5
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Only methods as programming functions are affected. Besides renaming
some actions like "Switch Between Function Declaration/Definition" this
mostly touches (api) code comments.
This is a follow-up patch to commit 872bfb7.
Change-Id: Icb65e8d73b59a022f8885b14df497169543a3b92
Reviewed-by: hjk <hjk121@nokiamail.com>
Fix grammar and style issues and punctuation.
Use the \a command instead of \param (not a QDoc command).
Change-Id: Ib048f0219a2c857e5fc3fcd858afbcbd58819193
Reviewed-by: David Schulz <david.schulz@digia.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Done by reserving enough space in for the various QLists when created,
and by preventing unnecessary copying of lists.
Change-Id: I5a9f0f7042bbaa1cf5eb076b956c35f2191468c6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Factor out and streamline code from the annotation highlighter
to create a list of colors suitable for highlighting and use that
in memory view.
Task-number: QTCREATORBUG-8250
Change-Id: Iefd408847897ddc98e3aecd6e4f084d1415b80c0
Reviewed-by: hjk <qthjk@ovi.com>
This can happen when the semantic highlighter (which runs in a future)
calculates a range for a document that has been changed in the meantime.
Task-number: QTCREATORBUG-7995
Change-Id: Ibcd1a6ae840e08570a6b6ea4caf411e799ec26c8
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
When folding indents change and a block becomes no longer
folded we need to update the user data. This patch tries
to handle general inconsistencies that might arise in such
situations. Notice however that there are stil other problems
to be addressed (including issues in Qt).
Task-number: QTCREATORBUG-5771
Change-Id: I38b869832159598d46cde00058308c218ca31f1a
Reviewed-on: http://codereview.qt.nokia.com/2908
Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
Reviewed-by: Matthias Ettrich
Not a good idea to keep the editor stored since when removing
a split, for example, the editor will go away and the highlighter
is not aware of it anyhow since it actually belongs to the document.
Although it's not necessary for the fix this patch add another
constructor to SyntaxHighlighter which takes the BaseTextDocument.
This is convenient.
Task-number: QTCREATORBUG-5695
Change-Id: Ic91837b7d91ebd3a44c16e2fd589d7f6c5c0c002
Reviewed-on: http://codereview.qt.nokia.com/2508
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
The generic highlighter already provided a method for this.
This method was then lifted to the base syntax highlighter
and it is now used by the profile highlighter.
Reviewed-by: Roberto Raggi
Task-number: QTCREATORBUG-2448