- enhancement: show completion suggest for "namespace" after "using"

- fix: MinGW-w64 gcc displayed as "MinGW GCC"
This commit is contained in:
Roy Qu 2022-11-25 10:01:10 +08:00
parent 378cdeefd2
commit 8788e950dd
5 changed files with 21 additions and 8 deletions

View File

@ -8,6 +8,8 @@ Red Panda C++ Version 2.5
- enhancement: Options -> editor -> custom C/C++ type keywords page
- change: Default value of option "Editors share one code analyzer" is ON if available physical memory <= 32G
- change: Default value of option "Auto clear symbols in hidden editors" is ON if number of CPU cores > 8 and "Editors share one code analyzer" is on
- enhancement: show completion suggest for "namespace" after "using"
- fix: MinGW-w64 gcc displayed as "MinGW GCC"
Red Panda C++ Version 2.4

View File

@ -728,8 +728,14 @@ void Editor::keyPressEvent(QKeyEvent *event)
return;
} else if (mLastIdCharPressed==pSettings->codeCompletion().minCharRequired()){
QString lastWord = getPreviousWordAtPositionForSuggestion(caretXY());
if (mParser && !lastWord.isEmpty()) {
if (CppTypeKeywords.contains(lastWord)) {
if (lastWord == "using") {
commandProcessor(QSynedit::EditCommand::ecChar,ch,nullptr);
showCompletion(lastWord,false, CodeCompletionType::ComplexKeyword);
handled=true;
return;
} else if (CppTypeKeywords.contains(lastWord)) {
PStatement currentScope = mParser->findScopeStatement(mFilename,caretY());
while(currentScope && currentScope->kind==StatementKind::skBlock) {
currentScope = currentScope->parentScope.lock();
@ -747,7 +753,7 @@ void Editor::keyPressEvent(QKeyEvent *event)
lastWord == "unsigned"
) {
commandProcessor(QSynedit::EditCommand::ecChar,ch,nullptr);
showCompletion(lastWord,false, CodeCompletionType::TypeKeywordComplex);
showCompletion(lastWord,false, CodeCompletionType::ComplexKeyword);
handled=true;
return;
}

View File

@ -2135,13 +2135,15 @@ void Settings::CompilerSet::setProperties(const QString &binDir, const QString&
mCompilerType = CompilerType::GCC_UTF8;
// Assemble user friendly name if we don't have one yet
if (mName == "") {
if (mType.contains("tdm64")) {
if (mType.contains("tdm64",Qt::CaseInsensitive)) {
mName = "TDM-GCC " + mVersion;
} else if (mType.contains("tdm")) {
} else if (mType.contains("tdm",Qt::CaseInsensitive)) {
mName = "TDM-GCC " + mVersion;
} else if (mType.contains("MSYS2")) {
} else if (mType.contains("MSYS2",Qt::CaseInsensitive)) {
mName = "MinGW-w64 GCC " + mVersion;
} else if (mType.contains("GCC")) {
} else if (mType.contains("MinGW-W64",Qt::CaseInsensitive)) {
mName = "MinGW-w64 GCC " + mVersion;
} else if (mType.contains("GCC",Qt::CaseInsensitive)) {
#ifdef Q_OS_WIN
mName = "MinGW GCC " + mVersion;
#else

View File

@ -92,7 +92,7 @@ void CodeCompletionPopup::prepareSearch(
mMemberPhrase = memberExpression.join("");
mMemberOperator = memberOperator;
if (type == CodeCompletionType::TypeKeywordComplex) {
if (type == CodeCompletionType::ComplexKeyword) {
getCompletionListForTypeKeywordComplex(preWord);
} else if (type == CodeCompletionType::FunctionWithoutDefinition) {
mIncludedFiles = mParser->getFileIncludes(filename);
@ -898,6 +898,9 @@ void CodeCompletionPopup::getCompletionListForTypeKeywordComplex(const QString &
addKeyword("short");
addKeyword("int");
addKeyword("char");
} else if (preWord == "using") {
addKeyword("namespace");
}
}

View File

@ -39,7 +39,7 @@ private:
enum class CodeCompletionType {
Normal,
TypeKeywordComplex,
ComplexKeyword,
FunctionWithoutDefinition
};