| 718 | } |
| 719 | |
| 720 | void SourceFormatterController::FileFormatter::formatDocument(IDocument& doc) const |
| 721 | { |
| 722 | Q_ASSERT(m_formatter); |
| 723 | Q_ASSERT(doc.url() == m_url); |
| 724 | |
| 725 | qCDebug(SHELL) << "Running" << m_formatter->name() << "on" << m_url; |
| 726 | |
| 727 | // We don't use KTextEditor::Document directly, because CodeRepresentation transparently works |
| 728 | // around a possible tab-replacement incompatibility between kate and kdevelop |
| 729 | auto code = KDevelop::createCodeRepresentation(IndexedString{m_url}); |
| 730 | |
| 731 | const auto cursor = doc.cursorPosition(); |
| 732 | |
| 733 | QString text = format(code->text()); |
| 734 | text = addModeline(text); |
| 735 | code->setText(text); |
| 736 | |
| 737 | doc.setCursorPosition(cursor); |
| 738 | } |
| 739 | |
| 740 | void SourceFormatterController::settingsChanged() |
| 741 | { |
no test coverage detected