Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 4.12.2
-
None
-
Qt Creator (4.12.1 and 4.12.2)
Windows and macOS
-
-
626807c94e3c1e3d947de2359f26e15dd82641f7 (qt-creator/qt-creator/4.12) ba580bba83a261e6327334b947c01fa172b30362
Description
When a line ends in a string delimiter (" or ') followed by a newline, syntax coloring fails. On subsequent lines following the string constant, the highlight colors are applied to the next line.
For example, here the shader code is on the next line for readability.
fragmentShader: "
varying highp vec2 qt_TexCoord0;
uniform sampler2D source;
...
If the newline follows immediately after the ", syntax highlighting is off by one on all the following lines. The highlighting is off by an additional line for each instance of a delimiter following by a newline.
As a workaround, place a space after the string delimiter and highlighting works as expected.
Update: unfortunately, every time you save a file in Creator, it trims trailing white space from the file, which in turn causes this issue to return.
-----------------------------------
Reopen Update:
With 4.12.2, the previous case described is fixed, but there is a new, similar issue.
Now, if a line ends with a string delimiter immediately followed a newline, it works as intended. But if a line has a delimiter followed by anything on that line, then highlighting is once again off by one line, though now the highlights for the line are taken from the next line.
The following multiline string causes QML highlighting to fail.
property string aString: "asdf string"
But if the first delimiter is followed immediately by the new line, it works as expected:
property string aString: " asdf string"
And if the first line of the string has the newline escaped, it works as expected. Only the first line has an effect:
property string aString: "asdf \ string "
And if you put one or more escaped delimiters in the string, on the first line, highlighting works again
property string aString: "as\"df
string"
As before, the highlighting is off by an additional line for each problematic multiline string.
Attachments
Issue Links
- is duplicated by
-
QTCREATORBUG-24147 Syntax Highlighting breaks with new line
- Closed
For Gerrit Dashboard: QTCREATORBUG-23777 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
298820,6 | QmlJS: Fix line number for string literals | 4.12 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
303647,2 | QmlJS: Fix line number for string literals (Part 2) | 4.12 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |