aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/highlighter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Highlighter: Fix resolution of highlighting definitionEike Ziller2020-03-241-15/+13
| | | | | | | | | | | We should try to find a definition based on the file path first, before falling back to the MIME type, since MIME types are not extensible. So, if we find a definition for a MIME type, there could be others, more suited ones based on the file path. Fixes: QTCREATORBUG-7906 Change-Id: I9b35efb26d287dd4c975a8944fca9a310c417394 Reviewed-by: David Schulz <david.schulz@qt.io>
* Highlighter: Fix typoEike Ziller2020-03-241-3/+3
| | | | | Change-Id: I491f7c58733a333a5cdcf2ebae67f9d4bff1eeef Reviewed-by: David Schulz <david.schulz@qt.io>
* Highlighter: Remove unused methodsEike Ziller2020-03-241-29/+0
| | | | | | | We want all the possible definitions nowadays. Change-Id: I491d40b103a2daf187571910bb43c32e0bfbb1e4 Reviewed-by: David Schulz <david.schulz@qt.io>
* Merge remote-tracking branch 'origin/4.11'Eike Ziller2020-01-081-1/+3
|\ | | | | | | Change-Id: Ica0d173a08ff3f0296e875aa324d5bb6974bd90f
| * Editor: always set format for visual whitespaceDavid Schulz2020-01-071-1/+3
| | | | | | | | | | | | | | Change-Id: I2ab4cb9f77d649c1c7d51dec1ef11005325a4710 Fixes: QTCREATORBUG-23040 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | TextEditor: Fix typo in a TextDocumentLayout functionNikolai Kosjar2019-12-181-1/+1
| | | | | | | | | | Change-Id: I17153d9bfe9820f3ccc88f54bce1d494a522be33 Reviewed-by: David Schulz <david.schulz@qt.io>
* | Move helper functions to more public locationChristian Stenger2019-11-151-41/+5
|/ | | | | Change-Id: I12a2000bfc82c194d12fb5c25302a06f782aa605 Reviewed-by: David Schulz <david.schulz@qt.io>
* Highlighter: update all editors after downloading additional definitionsDavid Schulz2019-11-041-0/+1
| | | | | | | | | Instead of just the editor with the info bar that was triggering the download action or none editor if the action was triggered from the settings dialog. Change-Id: I4158eeb7fdb0a763d082c6d801b400e8635c7f38 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Highlighter: clarify 'Update Definitions' actionDavid Schulz2019-11-041-1/+14
| | | | | | | | | | | | by renaming it to Download Definitions and adding a tooltip stating that it collects all definitions that are missing or were updated after the release and downloads it to the ksyntax highlighting user folder. Also adding a separate reload definitions button in the settings behind the user path. Change-Id: I059cc98e33147cae910fa4fdb35631d1dca81448 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Highlighter: Apply specific ksyntax format attributesDavid Schulz2019-07-081-1/+71
| | | | | | | | | | | | | If a ksyntax format explicitly defines font attributes like bold, italic, underline or strike through we now apply those attributes. If the format defines a colors, we first check whether the color is readable before setting it. Fixes: QTCREATORBUG-22646 Fixes: QTCREATORBUG-22229 Fixes: QTCREATORBUG-13545 Change-Id: Id0389b3c71a078dc6d6df74ee5de7f5d479a9bcb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Highlighter: Use file pattern matching if mime type is 'text/plain'David Schulz2019-06-241-7/+21
| | | | | | | | | | | Do not try to match 'text/plain' mime types against highlight definitions, because it is automatically set if the file contains just printable characters in the first bytes, in this case file pattern matching gives better results. Fixes: QTCREATORBUG-22540 Change-Id: Ifd662cd6961011f5cf5d9232ce5f17d2314b4824 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Merge remote-tracking branch 'origin/4.9' into 4.10Eike Ziller2019-06-121-9/+12
|\ | | | | | | Change-Id: I7725557a279cc13fe03a72c20accf63b50571608
| * TextEditor: force rehighlight of next block if state changedDavid Schulz2019-06-071-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the user state of a block changes while it gets highlighted the next block will be rehighlighted too. Currently we store the indentation depth in the block user state. So in order to store the indentation depth _and_ the information whether the next block needs to be rehighlighted we bit shift the indentation depth via the brace depth helper functions from TextDocumentLayaout. And we cannot store the struct KSyntaxHighlighting::State in the block user state (int) directly to indicate that the next block also needs a rehighlight so we toggle just the last bit of the user state. Fixes: QTCREATORBUG-22290 Change-Id: I632f4416a725dc5fa1667bcab34fb2701294c9b8 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Utils: Rename FileName to FilePathhjk2019-05-281-3/+3
|/ | | | | | | | More in line with QFileInfo terminonlogy which appears to be best-of-breed within Qt. Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* TextEditor: fix folding regression in generic highlighterDavid Schulz2019-05-031-5/+45
| | | | | | Fixes: QTCREATORBUG-22346 Change-Id: Ib35a70da77ffaa3b84e1d85a855625e2086625da Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* TextEditor: fix highlighting whitespaces with ksyntax highlighterDavid Schulz2019-03-141-0/+1
| | | | | | Fixes: QTCREATORBUG-22097 Change-Id: Ia69198635e289fc6eff8d95bf1cdf59bda2e04e1 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* TextEditor: Fix matching parenthesis highlight reggressionDavid Schulz2019-03-071-0/+22
| | | | | | | | | The update to the new KSyntaxHighlight engine was missing the matching parenthesis highlight that was implemented in the generic highligter. Fixes: QTCREATORBUG-22095 Change-Id: Ibac0f0739b4e1df63aadf0f18f1b76873e63a2fc Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* SyntaxHighlighter: Update to latest masterChristian Stenger2019-03-041-1/+1
| | | | | | | Adapt the respective include inside the TextEditor. Change-Id: Ie3cb17f1b0e3c0639840bc135156edd354a0aeda Reviewed-by: David Schulz <david.schulz@qt.io>
* TextEditor: add option to remember highlighter definitionDavid Schulz2019-02-281-7/+87
| | | | | | | | | Add a button to the multiple definition found info that saves the definition of the current highlighter for the open document. Change-Id: I04b1b7571a864d781747547a1d315ec25bb6b5a1 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* TextEditor: Show info when multiple highlight definitions are availableDavid Schulz2019-02-111-0/+5
| | | | | | | | | Show an editor info bar when multiple highlight definitions can be found for a single file or mime type. Add a combo box to the info that allows the user to choose between them. Change-Id: I07278d065e19d4e04fba24a6d789c8b6c9f55d60 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* TextEditor: return all definitions for a file name/mimetype/documentDavid Schulz2019-02-071-0/+21
| | | | | Change-Id: Ifd4ee9ab71b95a66cf11e30e2de688d421094a4a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* TextEditor: shorten namespace noiseDavid Schulz2019-02-071-4/+4
| | | | | Change-Id: I16bc218ccefb7234cb9c1299ee3022549b178600 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* TextEditor: add convenient definition for document functionDavid Schulz2019-02-071-0/+12
| | | | | Change-Id: I8bbaec71a4682e36d3919924932b410e2e9d74a9 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* TextEditor: replace generic highlighter with ksyntaxhighlightingDavid Schulz2019-01-281-0/+158
Fixes: QTCREATORBUG-21029 Change-Id: I9894c4384e0e47da6bf030b7b8e07c3ad4737ff3 Reviewed-by: Orgad Shaneh <orgads@gmail.com>