From 8a0f7bcfd5ddf0727304f531d021e9ff0b991b01 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 7 Feb 2019 13:40:39 +0100 Subject: TextEditor: add option to remember highlighter definition 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 Reviewed-by: Leena Miettinen --- src/plugins/texteditor/highlighter.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/plugins/texteditor/highlighter.h') diff --git a/src/plugins/texteditor/highlighter.h b/src/plugins/texteditor/highlighter.h index 776f92faf3..92e7e136c1 100644 --- a/src/plugins/texteditor/highlighter.h +++ b/src/plugins/texteditor/highlighter.h @@ -38,6 +38,8 @@ class TextDocument; class Highlighter : public SyntaxHighlighter, public KSyntaxHighlighting::AbstractHighlighter { + Q_OBJECT + Q_INTERFACES(KSyntaxHighlighting::AbstractHighlighter) public: using Definition = KSyntaxHighlighting::Definition; using Definitions = QList; @@ -45,12 +47,16 @@ public: static Definition definitionForDocument(const TextDocument *document); static Definition definitionForMimeType(const QString &mimeType); - static Definition definitionForFileName(const QString &fileName); + static Definition definitionForFilePath(const Utils::FileName &fileName); static Definition definitionForName(const QString &name); static Definitions definitionsForDocument(const TextDocument *document); static Definitions definitionsForMimeType(const QString &mimeType); - static Definitions definitionsForFileName(const QString &fileName); + static Definitions definitionsForFileName(const Utils::FileName &fileName); + + static void rememberDefintionForDocument(const Definition &definition, + const TextDocument *document); + static void clearDefintionForDocumentCache(); static void addCustomHighlighterPath(const Utils::FileName &path); static void updateDefinitions(std::function callback = nullptr); -- cgit v1.2.1