diff options
Diffstat (limited to 'src/plugins/texteditor/highlighter.cpp')
-rw-r--r-- | src/plugins/texteditor/highlighter.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/texteditor/highlighter.cpp b/src/plugins/texteditor/highlighter.cpp index 1a12d96882..09f9b88ff9 100644 --- a/src/plugins/texteditor/highlighter.cpp +++ b/src/plugins/texteditor/highlighter.cpp @@ -29,7 +29,9 @@ #include "textdocumentlayout.h" #include "tabsettings.h" #include "texteditorsettings.h" +#include "texteditor.h" +#include <coreplugin/editormanager/documentmodel.h> #include <coreplugin/icore.h> #include <coreplugin/messagemanager.h> #include <utils/mimetypes/mimedatabase.h> @@ -250,7 +252,7 @@ void Highlighter::addCustomHighlighterPath(const Utils::FilePath &path) highlightRepository()->addCustomSearchPath(path.toString()); } -void Highlighter::updateDefinitions(std::function<void()> callback) { +void Highlighter::downloadDefinitions(std::function<void()> callback) { auto downloader = new KSyntaxHighlighting::DefinitionDownloader(highlightRepository()); connect(downloader, &KSyntaxHighlighting::DefinitionDownloader::done, @@ -271,6 +273,17 @@ void Highlighter::updateDefinitions(std::function<void()> callback) { downloader->start(); } +void Highlighter::reload() +{ + highlightRepository()->reload(); + for (auto editor : Core::DocumentModel::editorsForOpenedDocuments()) { + if (auto textEditor = qobject_cast<BaseTextEditor *>(editor)) { + if (qobject_cast<Highlighter *>(textEditor->textDocument()->syntaxHighlighter())) + textEditor->editorWidget()->configureGenericHighlighter(); + } + } +} + void Highlighter::handleShutdown() { delete highlightRepository(); |