Skip to content

problemreporter: handle text document URL changes

Igor Kushnir requested to merge work/problem-reporter-handle-doc-url-change into master

A text document's URL can be changed when:

  1. a new Untitled document is saved;
  2. an open document is saved under a different name (File=>Save As...).

ProblemReporterPlugin does not listen to IDocumentController::documentUrlChanged signal, and therefore keeps referencing text documents by stale URLs. So when a document is renamed, then another document is created or opened at its previous URL, the assertion Q_ASSERT(!m_visualizers.contains(documentUrl)); in ProblemReporterPlugin::textDocumentCreated() fails. Another consequence is that inline problem notes never appear in the renamed document.

Replace the URL key of the renamed document's visualizer and remove the obsolete URL from m_reHighlightNeeded set.

When the default problem scope "Current Document" is selected, an active document is not highlighted right after it is renamed. The user has to activate another document, then go back to the renamed one for the highlighting to appear. This is a consequence of another missing connection to the documentUrlChanged signal in ProblemModel. Will be addressed in a subsequent commit.

BUG: 468595
FIXED-IN: 5.13.231200

Edited by Igor Kushnir

Merge request reports