fix: editor not parsed when first load
fix: TODO is wrongly parsed when new a file (that exists in the current folder)
This commit is contained in:
parent
a31bc6ef17
commit
1eb7bdf549
|
@ -202,6 +202,10 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
|||
connect(verticalScrollBar(), &QScrollBar::valueChanged,
|
||||
this, &Editor::onScrollBarValueChanged);
|
||||
mInited=true;
|
||||
|
||||
reparse(false);
|
||||
checkSyntaxInBack();
|
||||
reparseTodo();
|
||||
}
|
||||
|
||||
Editor::~Editor() {
|
||||
|
@ -324,10 +328,6 @@ bool Editor::save(bool force, bool doReparse) {
|
|||
if (this->mIsNew && !force) {
|
||||
return saveAs();
|
||||
}
|
||||
// while (pMainWindow->parsing()) {
|
||||
// QThread::msleep(200);
|
||||
// }
|
||||
//is this file writable;
|
||||
|
||||
pMainWindow->fileSystemWatcher()->removePath(mFilename);
|
||||
try {
|
||||
|
@ -2980,6 +2980,8 @@ void Editor::reparse(bool resetParser)
|
|||
|
||||
void Editor::reparseTodo()
|
||||
{
|
||||
if (!mInited)
|
||||
return;
|
||||
if (!mParentPageControl)
|
||||
return;
|
||||
if (!syntaxer())
|
||||
|
@ -4820,6 +4822,8 @@ void Editor::reformat(bool doReparse)
|
|||
|
||||
void Editor::checkSyntaxInBack()
|
||||
{
|
||||
if (!mInited)
|
||||
return;
|
||||
if (!mParentPageControl)
|
||||
return;
|
||||
if (readOnly())
|
||||
|
|
|
@ -58,13 +58,6 @@ Editor* EditorList::newEditor(const QString& filename, const QByteArray& encodin
|
|||
Editor * e = new Editor(parentPageControl,filename,encoding,pProject,newFile,parentPageControl);
|
||||
connect(e, &Editor::renamed, this, &EditorList::onEditorRenamed);
|
||||
updateLayout();
|
||||
// if (pMainWindow->project()){
|
||||
// PProjectUnit unit = pMainWindow->project()->findUnit(filename);
|
||||
// if (unit) {
|
||||
// pMainWindow->project()->associateEditorToUnit(e,unit);
|
||||
// e->setInProject(true);
|
||||
// }
|
||||
// }
|
||||
connect(e,&Editor::fileSaved,
|
||||
pMainWindow, &MainWindow::onFileSaved);
|
||||
return e;
|
||||
|
|
|
@ -1538,6 +1538,9 @@ QStringList CppParser::sortFilesByIncludeRelations(const QSet<QString> &files)
|
|||
QStringList buffer;
|
||||
if (mOnGetFileStream) {
|
||||
mOnGetFileStream(file,buffer);
|
||||
//prevent preprocessor to read file
|
||||
if (buffer.isEmpty())
|
||||
buffer.append(QString());
|
||||
}
|
||||
//we only use local include relations
|
||||
mPreprocessor.setScanOptions(false, true);
|
||||
|
@ -3793,6 +3796,9 @@ void CppParser::internalParse(const QString &fileName)
|
|||
QStringList buffer;
|
||||
if (mOnGetFileStream) {
|
||||
mOnGetFileStream(fileName,buffer);
|
||||
//prevent preprocessor to read file
|
||||
if (buffer.isEmpty())
|
||||
buffer.append(QString());
|
||||
}
|
||||
|
||||
// Preprocess the file...
|
||||
|
|
|
@ -110,9 +110,7 @@ const QString &SystemConsts::defaultAllFileFilter() const noexcept
|
|||
QString SystemConsts::fileFilterFor(const QString &suffix)
|
||||
{
|
||||
QString t="*."+suffix;
|
||||
qDebug()<<" * "<<t;
|
||||
foreach(const QString filter,mDefaultFileFilters) {
|
||||
qDebug()<<filter;
|
||||
int pos = filter.lastIndexOf("(");
|
||||
int pos2 = filter.lastIndexOf(")");
|
||||
if (pos<0 || pos2<=pos)
|
||||
|
@ -120,7 +118,6 @@ QString SystemConsts::fileFilterFor(const QString &suffix)
|
|||
QString suffixes=filter.mid(pos+1,pos2-pos-1);
|
||||
QStringList suffixList = suffixes.split(" ");
|
||||
foreach( const QString& s, suffixList) {
|
||||
qDebug()<<" - "<<s;
|
||||
if (s.trimmed()==t)
|
||||
return filter;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue