From bbdefc4af0c4932a604764e30c2c2b655a41cb22 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 14 Aug 2023 22:37:34 +0800 Subject: [PATCH] - fix: Can't suggest header filename starting with numbers. --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 8 +++++++- RedPandaIDE/settings.cpp | 32 ++++++++++++++++++++++++++------ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/NEWS.md b/NEWS.md index b08f0d69..e52fd412 100644 --- a/NEWS.md +++ b/NEWS.md @@ -30,6 +30,7 @@ Red Panda C++ Version 2.24 - enhancement: Support sdcc compiler. - enhancement: Autowrap tool output text. - fix: Press up/down arrow key in the option dialog's left panel won't switch page. + - fix: Can't suggest header filename starting with numbers. Red Panda C++ Version 2.23 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 26907c3a..563c8226 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -961,7 +961,13 @@ void Editor::keyPressEvent(QKeyEvent *event) } else { if (pSettings->codeCompletion().enabled() && pSettings->codeCompletion().showCompletionWhileInput() ) { - if (syntaxer() && syntaxer()->language()==QSynedit::ProgrammingLanguage::CPP) { + if (mParser && mParser->isIncludeLine(lineText())) { + // is a #include line + processCommand(QSynedit::EditCommand::Char,ch,nullptr); + showHeaderCompletion(false); + handled=true; + return; + } else if (syntaxer() && syntaxer()->language()==QSynedit::ProgrammingLanguage::CPP) { //preprocessor ? if ((idCharPressed==0) && (ch=='#') && lineText().isEmpty()) { processCommand(QSynedit::EditCommand::Char,ch,nullptr); diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 95dd7969..449ef9e8 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -2348,6 +2348,19 @@ QStringList Settings::CompilerSet::defines(bool isCpp) { arguments.append("c"); arguments.append("-V"); key=SDCC_CMD_OPT_PROCESSOR; + //language standard + PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerType(), key); + if (pOption) { + if (!mCompileOptions[key].isEmpty()) + arguments.append(pOption->setting + mCompileOptions[key]); + } + key=SDCC_CMD_OPT_STD; + //language standard + pOption = CompilerInfoManager::getCompilerOption(compilerType(), key); + if (pOption) { + if (!mCompileOptions[key].isEmpty()) + arguments.append(pOption->setting + mCompileOptions[key]); + } } else { #endif if (isCpp) { @@ -2357,15 +2370,16 @@ QStringList Settings::CompilerSet::defines(bool isCpp) { arguments.append("c"); key=C_CMD_OPT_STD; } + //language standard + PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerType(), key); + if (pOption) { + if (!mCompileOptions[key].isEmpty()) + arguments.append(pOption->setting + mCompileOptions[key]); + } #ifdef ENABLE_SDCC } #endif - //language standard - PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerType(), key); - if (pOption) { - if (!mCompileOptions[key].isEmpty()) - arguments.append(pOption->setting + mCompileOptions[key]); - } + arguments.append(NULL_FILE); @@ -2610,6 +2624,12 @@ void Settings::CompilerSet::setSDCCDirectories(const QString& binDir) QStringList arguments; arguments.clear(); arguments.append("--print-search-dirs"); + QString key = SDCC_CMD_OPT_PROCESSOR; + PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerType(), key); + if (pOption) { + if (!mCompileOptions[key].isEmpty()) + arguments.append(pOption->setting + mCompileOptions[key]); + } QByteArray output = getCompilerOutput(binDir,c_prog,arguments); //bindirs