forked from qt-creator/qt-creator
Clang: Fix reloading documents
Fix the following use case: * Open foo.h * Open foo.cpp * Change both files externally (e.g. git checkout) e.g. by adding a function (declaration + definition) * Confirm the reload dialog in Qt Creator * The added function in foo.cpp gets a diagnostic that it's out of line although foo.h is also reloaded. TextDocument::contentsChangedWithPosition() is also emitted during a reload. However, the revision of the document at that point is not yet updated. This led to an out-dated copy of the unsaved files in the clang backend. Change-Id: I70580d32bb7a34dc43356dc05019cc18addf950e Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -72,10 +72,12 @@ public:
|
||||
private:
|
||||
void onEditorOpened(Core::IEditor *editor);
|
||||
void onCurrentEditorChanged(Core::IEditor *newCurrent);
|
||||
void onCppDocumentAboutToReloadOnTranslationUnit();
|
||||
void onCppDocumentReloadFinishedOnTranslationUnit(bool success);
|
||||
void onCppDocumentContentsChangedOnTranslationUnit(int position,
|
||||
int charsRemoved,
|
||||
int charsAdded);
|
||||
void onCppDocumentAboutToReloadOnUnsavedFile();
|
||||
void onCppDocumentReloadFinishedOnUnsavedFile(bool success);
|
||||
void onCppDocumentContentsChangedOnUnsavedFile();
|
||||
|
||||
@@ -93,6 +95,9 @@ private:
|
||||
|
||||
void connectTextDocumentToTranslationUnit(TextEditor::TextDocument *textDocument);
|
||||
void connectTextDocumentToUnsavedFiles(TextEditor::TextDocument *textDocument);
|
||||
void connectToTextDocumentContentsChangedForTranslationUnit(
|
||||
TextEditor::TextDocument *textDocument);
|
||||
void connectToTextDocumentContentsChangedForUnsavedFile(TextEditor::TextDocument *textDocument);
|
||||
void connectToWidgetsMarkContextMenuRequested(QWidget *editorWidget);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user