- fix: Don't show completion info when input parameters for function definitions.
- fix: Don't show function info tips when typing class variable definitions. - fix: Compare error in debug mode.
This commit is contained in:
parent
f8076dd069
commit
626217f856
2
NEWS.md
2
NEWS.md
|
@ -18,6 +18,8 @@ Red Panda C++ Version 2.18
|
||||||
- fix: The comboxbox to input evaluation expression in the debug panel is case insensitive.
|
- fix: The comboxbox to input evaluation expression in the debug panel is case insensitive.
|
||||||
- fix: The comboxbox to input replace text in the search panel is case insensitive.
|
- fix: The comboxbox to input replace text in the search panel is case insensitive.
|
||||||
- fix: None initialized std::vector is not correctly displayed in the gdb of the gcc distributed with redpanda-c++ (Windows 64bit).
|
- fix: None initialized std::vector is not correctly displayed in the gdb of the gcc distributed with redpanda-c++ (Windows 64bit).
|
||||||
|
- fix: Don't show completion info when input parameters for function definitions.
|
||||||
|
- fix: Don't show function info tips when typing class variable definitions.
|
||||||
|
|
||||||
Red Panda C++ Version 2.17
|
Red Panda C++ Version 2.17
|
||||||
|
|
||||||
|
|
|
@ -1780,7 +1780,7 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changes.testFlag(QSynedit::scInsertMode) | changes.testFlag(QSynedit::scReadOnly))
|
if (changes.testFlag(QSynedit::scInsertMode) || changes.testFlag(QSynedit::scReadOnly))
|
||||||
pMainWindow->updateForStatusbarModeInfo();
|
pMainWindow->updateForStatusbarModeInfo();
|
||||||
|
|
||||||
pMainWindow->updateEditorActions();
|
pMainWindow->updateEditorActions();
|
||||||
|
@ -3573,45 +3573,71 @@ void Editor::cleanAutoBackup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Editor::testInFunc(int x, int y)
|
bool Editor::testInFunc(const QSynedit::BufferCoord& pos)
|
||||||
{
|
{
|
||||||
bool result = false;
|
int y=pos.line-1;
|
||||||
QString s = document()->getLine(y);
|
int x=pos.ch;
|
||||||
int posY = y;
|
if (!syntaxer() || syntaxer()->language()!=QSynedit::ProgrammingLanguage::CPP)
|
||||||
int posX = std::min(x,s.length()-1); // x is started from 1
|
return false;
|
||||||
int bracketLevel=0;
|
if (y==0)
|
||||||
while (true) {
|
syntaxer()->resetState();
|
||||||
while (posX < 0) {
|
else
|
||||||
posY--;
|
syntaxer()->setState(document()->getSyntaxState(y-1));
|
||||||
if (posY < 0)
|
syntaxer()->setLine(document()->getLine(y),y);
|
||||||
return false;
|
// qDebug()<<x<<document()->getLine(y).length();
|
||||||
s = document()->getLine(posY);
|
QSynedit::SyntaxState state = syntaxer()->getState();
|
||||||
posX = s.length()-1;
|
while(!syntaxer()->eol()) {
|
||||||
}
|
int start = syntaxer()->getTokenPos();
|
||||||
if (s[posX] == '>'
|
QString token = syntaxer()->getToken();
|
||||||
|| s[posX] == ']') {
|
int end = start + token.length();
|
||||||
bracketLevel++;
|
// qDebug()<<syntaxer()->getToken()<<start<<end;
|
||||||
} else if (s[posX] == '<'
|
if (end>=x)
|
||||||
|| s[posX] == '[') {
|
break;
|
||||||
bracketLevel--;
|
state = syntaxer()->getState();
|
||||||
} else if (bracketLevel==0) {
|
syntaxer()->next();
|
||||||
switch (s[posX].unicode()) {
|
|
||||||
case '(':
|
|
||||||
return true;
|
|
||||||
case ';':
|
|
||||||
case '{':
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!(isIdentChar(s[posX])
|
|
||||||
|| s[posX] == ' '
|
|
||||||
|| s[posX] == '\t'
|
|
||||||
|| s[posX] == '*'
|
|
||||||
|| s[posX] == '&'))
|
|
||||||
break;;
|
|
||||||
}
|
|
||||||
posX--;
|
|
||||||
}
|
}
|
||||||
return result;
|
// qDebug()<<state.parenthesisLevel;
|
||||||
|
return state.parenthesisLevel>0;
|
||||||
|
|
||||||
|
|
||||||
|
// bool result = false;
|
||||||
|
// QString s = document()->getLine(y);
|
||||||
|
// int posY = y;
|
||||||
|
// int posX = std::min(x,s.length()-1); // x is started from 1
|
||||||
|
// int bracketLevel=0;
|
||||||
|
|
||||||
|
// while (true) {
|
||||||
|
// while (posX < 0) {
|
||||||
|
// posY--;
|
||||||
|
// if (posY < 0)
|
||||||
|
// return false;
|
||||||
|
// s = document()->getLine(posY);
|
||||||
|
// posX = s.length()-1;
|
||||||
|
// }
|
||||||
|
// if (s[posX] == '>'
|
||||||
|
// || s[posX] == ']') {
|
||||||
|
// bracketLevel++;
|
||||||
|
// } else if (s[posX] == '<'
|
||||||
|
// || s[posX] == '[') {
|
||||||
|
// bracketLevel--;
|
||||||
|
// } else if (bracketLevel==0) {
|
||||||
|
// switch (s[posX].unicode()) {
|
||||||
|
// case '(':
|
||||||
|
// return true;
|
||||||
|
// case ';':
|
||||||
|
// case '{':
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// if (!(isIdentChar(s[posX])
|
||||||
|
// || s[posX] == ' '
|
||||||
|
// || s[posX] == '\t'
|
||||||
|
// || s[posX] == '*'
|
||||||
|
// || s[posX] == '&'))
|
||||||
|
// break;;
|
||||||
|
// }
|
||||||
|
// posX--;
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::completionInsert(bool appendFunc)
|
void Editor::completionInsert(bool appendFunc)
|
||||||
|
@ -4188,7 +4214,6 @@ void Editor::updateFunctionTip(bool showTip)
|
||||||
QSynedit::BufferCoord pWordBegin, pWordEnd;
|
QSynedit::BufferCoord pWordBegin, pWordEnd;
|
||||||
|
|
||||||
QString s = getWordAtPosition(this, functionNamePos, pWordBegin,pWordEnd, WordPurpose::wpInformation);
|
QString s = getWordAtPosition(this, functionNamePos, pWordBegin,pWordEnd, WordPurpose::wpInformation);
|
||||||
|
|
||||||
int x = pWordBegin.ch-1-1;
|
int x = pWordBegin.ch-1-1;
|
||||||
QString line = document()->getLine(pWordBegin.line-1);
|
QString line = document()->getLine(pWordBegin.line-1);
|
||||||
bool hasPreviousWord=false;
|
bool hasPreviousWord=false;
|
||||||
|
@ -4206,9 +4231,10 @@ void Editor::updateFunctionTip(bool showTip)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//handle class initializer
|
||||||
if (x >= 0 && hasPreviousWord) {
|
if (x >= 0 && hasPreviousWord) {
|
||||||
QSynedit::BufferCoord pos = pWordBegin;
|
QSynedit::BufferCoord pos = pWordBegin;
|
||||||
pos.ch = x+1;
|
pos.ch = pWordBegin.ch;
|
||||||
QString previousWord = getPreviousWordAtPositionForSuggestion(pos);
|
QString previousWord = getPreviousWordAtPositionForSuggestion(pos);
|
||||||
|
|
||||||
PStatement statement = mParser->findStatementOf(
|
PStatement statement = mParser->findStatementOf(
|
||||||
|
@ -4779,7 +4805,7 @@ QString Editor::getPreviousWordAtPositionForSuggestion(const QSynedit::BufferCoo
|
||||||
if ((p.line<1) || (p.line>document()->count())) {
|
if ((p.line<1) || (p.line>document()->count())) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
bool inFunc = testInFunc(p.ch-1,p.line-1);
|
bool inFunc = testInFunc(p);
|
||||||
|
|
||||||
QString s = document()->getLine(p.line - 1);
|
QString s = document()->getLine(p.line - 1);
|
||||||
int wordBegin;
|
int wordBegin;
|
||||||
|
@ -4800,7 +4826,7 @@ QString Editor::getPreviousWordAtPositionForSuggestion(const QSynedit::BufferCoo
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
} else if (bracketLevel==0) {
|
} else if (bracketLevel==0) {
|
||||||
//we can't differentiate multiple definition and function parameter define here , so we don't handle ','
|
//Differentiate multiple definition and function parameter define here
|
||||||
if (s[wordEnd] == ',') {
|
if (s[wordEnd] == ',') {
|
||||||
if (inFunc) // in func, dont skip ','
|
if (inFunc) // in func, dont skip ','
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -271,7 +271,7 @@ private:
|
||||||
void saveAutoBackup();
|
void saveAutoBackup();
|
||||||
void cleanAutoBackup();
|
void cleanAutoBackup();
|
||||||
|
|
||||||
bool testInFunc(int x,int y);
|
bool testInFunc(const QSynedit::BufferCoord& pos);
|
||||||
|
|
||||||
void completionInsert(bool appendFunc=false);
|
void completionInsert(bool appendFunc=false);
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ void StatementModel::clear() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef QT_DEBUG
|
||||||
void StatementModel::dump(const QString &logFile)
|
void StatementModel::dump(const QString &logFile)
|
||||||
{
|
{
|
||||||
QFile file(logFile);
|
QFile file(logFile);
|
||||||
|
@ -93,7 +94,6 @@ void StatementModel::dump(const QString &logFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
|
||||||
void StatementModel::dumpAll(const QString &logFile)
|
void StatementModel::dumpAll(const QString &logFile)
|
||||||
{
|
{
|
||||||
QFile file(logFile);
|
QFile file(logFile);
|
||||||
|
@ -104,11 +104,16 @@ void StatementModel::dumpAll(const QString &logFile)
|
||||||
.arg(statement->command).arg(int(statement->kind))
|
.arg(statement->command).arg(int(statement->kind))
|
||||||
.arg(statement->type).arg(statement->fullName)
|
.arg(statement->type).arg(statement->fullName)
|
||||||
.arg((size_t)(statement->parentScope.lock().get()))
|
.arg((size_t)(statement->parentScope.lock().get()))
|
||||||
.arg((int)statement->classScope)
|
.arg((int)statement->accessibility)
|
||||||
.arg(statement->fileName)
|
.arg(statement->fileName)
|
||||||
.arg(statement->line)
|
.arg(statement->line)
|
||||||
.arg(statement->definitionFileName)
|
.arg(statement->definitionFileName)
|
||||||
.arg(statement->definitionLine)<<endl;
|
.arg(statement->definitionLine)<<
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||||
|
Qt::endl;
|
||||||
|
#else
|
||||||
|
endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ public:
|
||||||
const StatementMap& childrenStatements(const PStatement& statement = PStatement()) const;
|
const StatementMap& childrenStatements(const PStatement& statement = PStatement()) const;
|
||||||
const StatementMap& childrenStatements(std::weak_ptr<Statement> statement) const;
|
const StatementMap& childrenStatements(std::weak_ptr<Statement> statement) const;
|
||||||
void clear();
|
void clear();
|
||||||
void dump(const QString& logFile);
|
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
|
void dump(const QString& logFile);
|
||||||
void dumpAll(const QString& logFile);
|
void dumpAll(const QString& logFile);
|
||||||
#endif
|
#endif
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue