forked from qt-creator/qt-creator
qmlls: move isSematicInfoOutdated to private object
this avoid use of the (still unintialized q->d) in settingsChanged in the constructor Change-Id: Idd756fc88df166124c34a6177a9d598604634057 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -587,12 +587,17 @@ void QmlJSEditorDocumentPrivate::acceptNewSemanticInfo(const SemanticInfo &seman
|
||||
|
||||
void QmlJSEditorDocumentPrivate::updateOutlineModel()
|
||||
{
|
||||
if (q->isSemanticInfoOutdated())
|
||||
if (isSemanticInfoOutdated())
|
||||
return; // outline update will be retriggered when semantic info is updated
|
||||
|
||||
m_outlineModel->update(m_semanticInfo);
|
||||
}
|
||||
|
||||
bool QmlJSEditorDocumentPrivate::isSemanticInfoOutdated() const
|
||||
{
|
||||
return m_semanticInfo.revision() != q->document()->revision();
|
||||
}
|
||||
|
||||
static void cleanMarks(QVector<TextEditor::TextMark *> *marks, TextEditor::TextDocument *doc)
|
||||
{
|
||||
// if doc is null, this method is improperly called, so better do nothing that leave an
|
||||
@@ -664,7 +669,7 @@ void QmlJSEditorDocumentPrivate::setSemanticWarningSource(QmllsStatus::Source ne
|
||||
m_semanticHighlighter->setEnableWarnings(false);
|
||||
cleanDiagnosticMarks();
|
||||
cleanSemanticMarks();
|
||||
if (!q->isSemanticInfoOutdated()) {
|
||||
if (m_semanticInfo.isValid() && !isSemanticInfoOutdated()) {
|
||||
// clean up underlines for warning messages
|
||||
m_semanticHighlightingNecessary = false;
|
||||
m_semanticHighlighter->rerun(m_semanticInfo);
|
||||
@@ -690,7 +695,7 @@ void QmlJSEditorDocumentPrivate::setSemanticHighlightSource(QmllsStatus::Source
|
||||
break;
|
||||
case QmllsStatus::Source::EmbeddedCodeModel:
|
||||
m_semanticHighlighter->setEnableHighlighting(true);
|
||||
if (!q->isSemanticInfoOutdated()) {
|
||||
if (m_semanticInfo.isValid() && !isSemanticInfoOutdated()) {
|
||||
m_semanticHighlightingNecessary = false;
|
||||
m_semanticHighlighter->rerun(m_semanticInfo);
|
||||
}
|
||||
@@ -835,7 +840,7 @@ const SemanticInfo &QmlJSEditorDocument::semanticInfo() const
|
||||
|
||||
bool QmlJSEditorDocument::isSemanticInfoOutdated() const
|
||||
{
|
||||
return d->m_semanticInfo.revision() != document()->revision();
|
||||
return d->isSemanticInfoOutdated();
|
||||
}
|
||||
|
||||
QVector<QTextLayout::FormatRange> QmlJSEditorDocument::diagnosticRanges() const
|
||||
|
@@ -48,6 +48,7 @@ public:
|
||||
void onDocumentUpdated(QmlJS::Document::Ptr doc);
|
||||
void reupdateSemanticInfo();
|
||||
void acceptNewSemanticInfo(const QmlJSTools::SemanticInfo &semanticInfo);
|
||||
bool isSemanticInfoOutdated() const;
|
||||
void updateOutlineModel();
|
||||
|
||||
void createTextMarks(const QList<QmlJS::DiagnosticMessage> &diagnostics);
|
||||
|
Reference in New Issue
Block a user