forked from qt-creator/qt-creator
		
	QmlJS editor: Simplify document/semInfo updating significantly.
* Instead of having SemanticInfoUpdater reparse documents itself, it now relies on the ModelManager doing that. * SemanticInfoUpdater now takes a doc and snapshot to generate the convenience Context / ScopeChain. Could be converted into a future to avoid having a (99% idle) thread per editor. * Renamed several functions in QmlJSTextEditorWidget to better indicate their behavior. Change-Id: I8af6ccab099130fa7fa227e44864561ca2c3f9e0 Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
		
				
					committed by
					
						
						Leandro Melo
					
				
			
			
				
	
			
			
			
						parent
						
							fa6c3cc1ec
						
					
				
				
					commit
					56bf0e3023
				
			@@ -311,7 +311,7 @@ void QmlJSEditorPlugin::reformatFile()
 | 
			
		||||
{
 | 
			
		||||
    Core::EditorManager *em = Core::EditorManager::instance();
 | 
			
		||||
    if (QmlJSTextEditorWidget *editor = qobject_cast<QmlJSTextEditorWidget*>(em->currentEditor()->widget())) {
 | 
			
		||||
        QTC_ASSERT(!editor->isOutdated(), return);
 | 
			
		||||
        QTC_ASSERT(!editor->isSemanticInfoOutdated(), return);
 | 
			
		||||
 | 
			
		||||
        const QString &newText = QmlJS::reformat(editor->semanticInfo().document);
 | 
			
		||||
        QTextCursor tc(editor->textCursor());
 | 
			
		||||
@@ -364,7 +364,7 @@ void QmlJSEditorPlugin::currentEditorChanged(Core::IEditor *editor)
 | 
			
		||||
                this, SLOT(checkCurrentEditorSemanticInfoUpToDate()));
 | 
			
		||||
        connect(newTextEditor, SIGNAL(semanticInfoUpdated()),
 | 
			
		||||
                this, SLOT(checkCurrentEditorSemanticInfoUpToDate()));
 | 
			
		||||
        newTextEditor->forceReparse();
 | 
			
		||||
        newTextEditor->reparseDocumentNow();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -378,7 +378,7 @@ void QmlJSEditorPlugin::runSemanticScan()
 | 
			
		||||
 | 
			
		||||
void QmlJSEditorPlugin::checkCurrentEditorSemanticInfoUpToDate()
 | 
			
		||||
{
 | 
			
		||||
    const bool semanticInfoUpToDate = m_currentEditor && !m_currentEditor->isOutdated();
 | 
			
		||||
    const bool semanticInfoUpToDate = m_currentEditor && !m_currentEditor->isSemanticInfoOutdated();
 | 
			
		||||
    m_reformatFileAction->setEnabled(semanticInfoUpToDate);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user