diff --git a/NEWS.md b/NEWS.md index bb30f834..2e5551d6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -165,6 +165,7 @@ Red Panda C++ Version 2.27 - change: Set "Ctrl+G" as the shortcut for "Goto page..." - change: Set "Ctrl+B" as the shortcut for "Toggle Bookmark" - fix: Fail to evaluate expressions if macro can't be expanded. + - enhancement: New menu item "Code completion". Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 0f9b4ae2..689a1fbe 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -2338,6 +2338,23 @@ void Editor::gotoBlockEnd() processCommand(QSynedit::EditCommand::BlockEnd,QChar(),nullptr); } +void Editor::showCodeCompletion() +{ + if (!pSettings->codeCompletion().enabled()) + return; + + if (mParser) { + if (mParser->isIncludeLine(lineText())) { + // is a #include line + showHeaderCompletion(false); + } else { + showCompletion("",true,CodeCompletionType::Normal); + } + } else { + showCompletion("",true,CodeCompletionType::KeywordsOnly); + } +} + QStringList Editor::getOwnerExpressionAndMemberAtPositionForCompletion( const QSynedit::BufferCoord &pos, QString &memberOperator, diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index 5d8fd1a0..bc43c6c0 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -213,6 +213,7 @@ public: void deleteToBOL(); void gotoBlockStart(); void gotoBlockEnd(); + void showCodeCompletion(); QStringList getOwnerExpressionAndMemberAtPositionForCompletion( const QSynedit::BufferCoord& pos, diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 0d3129ad..e4816d11 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -10303,3 +10303,12 @@ void MainWindow::on_actionToggle_Bookmark_triggered() } } + +void MainWindow::on_actionCode_Completion_triggered() +{ + Editor* editor = mEditorList->getEditor(); + if (editor) { + editor->showCodeCompletion(); + } +} + diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index a678d0b9..0dc8dff7 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -858,6 +858,8 @@ private slots: void on_actionToggle_Bookmark_triggered(); + void on_actionCode_Completion_triggered(); + private: Ui::MainWindow *ui; bool mFullInitialized; diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index 3972846a..47302326 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -19,7 +19,7 @@ - QMainWindow::AnimatedDocks + QMainWindow::DockOption::AnimatedDocks @@ -68,7 +68,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal 1 @@ -119,8 +119,8 @@ 0 0 - 1935 - 24 + 2002 + 25 @@ -241,6 +241,8 @@ + + @@ -473,10 +475,10 @@ - QDockWidget::DockWidgetMovable + QDockWidget::DockWidgetFeature::DockWidgetMovable - Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea + Qt::DockWidgetArea::BottomDockWidgetArea|Qt::DockWidgetArea::LeftDockWidgetArea|Qt::DockWidgetArea::RightDockWidgetArea Explorer @@ -492,7 +494,7 @@ - QTabWidget::West + QTabWidget::TabPosition::West 4 @@ -550,7 +552,7 @@ true - QComboBox::InsertAtTop + QComboBox::InsertPolicy::InsertAtTop @@ -560,19 +562,19 @@ - QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked + QAbstractItemView::EditTrigger::EditKeyPressed|QAbstractItemView::EditTrigger::SelectedClicked true - QAbstractItemView::DragDrop + QAbstractItemView::DragDropMode::DragDrop - Qt::MoveAction + Qt::DropAction::MoveAction - QAbstractItemView::ExtendedSelection + QAbstractItemView::SelectionMode::ExtendedSelection false @@ -607,22 +609,22 @@ - QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked + QAbstractItemView::EditTrigger::EditKeyPressed|QAbstractItemView::EditTrigger::SelectedClicked true - QAbstractItemView::InternalMove + QAbstractItemView::DragDropMode::InternalMove - Qt::MoveAction + Qt::DropAction::MoveAction - QAbstractItemView::ExtendedSelection + QAbstractItemView::SelectionMode::ExtendedSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows 500 @@ -657,13 +659,13 @@ - QAbstractItemView::DoubleClicked + QAbstractItemView::EditTrigger::DoubleClicked - QAbstractItemView::ExtendedSelection + QAbstractItemView::SelectionMode::ExtendedSelection - Qt::ElideNone + Qt::TextElideMode::ElideNone false @@ -701,7 +703,7 @@ - Qt::ScrollBarAlwaysOn + Qt::ScrollBarPolicy::ScrollBarAlwaysOn true @@ -739,10 +741,10 @@ - QFrame::Panel + QFrame::Shape::Panel - QFrame::Plain + QFrame::Shadow::Plain Problem Set @@ -869,7 +871,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -888,19 +890,19 @@ true - QAbstractItemView::InternalMove + QAbstractItemView::DragDropMode::InternalMove - Qt::MoveAction + Qt::DropAction::MoveAction true - QAbstractItemView::ExtendedSelection + QAbstractItemView::SelectionMode::ExtendedSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows @@ -910,10 +912,10 @@ - QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetVerticalTitleBar + QDockWidget::DockWidgetFeature::DockWidgetMovable|QDockWidget::DockWidgetFeature::DockWidgetVerticalTitleBar - Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea + Qt::DockWidgetArea::BottomDockWidgetArea|Qt::DockWidgetArea::LeftDockWidgetArea|Qt::DockWidgetArea::RightDockWidgetArea Messages @@ -929,7 +931,7 @@ - QTabWidget::South + QTabWidget::TabPosition::South 2 @@ -965,7 +967,7 @@ - QAbstractItemView::NoEditTriggers + QAbstractItemView::EditTrigger::NoEditTriggers false @@ -977,10 +979,10 @@ true - QAbstractItemView::SingleSelection + QAbstractItemView::SelectionMode::SingleSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows true @@ -1012,7 +1014,7 @@ false - QPlainTextEdit::WidgetWidth + QPlainTextEdit::LineWrapMode::WidgetWidth true @@ -1047,17 +1049,17 @@ - Qt::Horizontal + Qt::Orientation::Horizontal 3 - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -1091,7 +1093,7 @@ true - QComboBox::InsertAtTop + QComboBox::InsertPolicy::InsertAtTop @@ -1109,7 +1111,7 @@ - QTabWidget::North + QTabWidget::TabPosition::North 3 @@ -1134,10 +1136,10 @@ - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Raised + QFrame::Shadow::Raised @@ -1166,13 +1168,13 @@ true - QAbstractItemView::SingleSelection + QAbstractItemView::SelectionMode::SingleSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows - Qt::ElideNone + Qt::TextElideMode::ElideNone true @@ -1204,13 +1206,13 @@ true - QAbstractItemView::SingleSelection + QAbstractItemView::SelectionMode::SingleSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows - Qt::ElideNone + Qt::TextElideMode::ElideNone true @@ -1282,7 +1284,7 @@ true - QComboBox::InsertAtTop + QComboBox::InsertPolicy::InsertAtTop @@ -1353,7 +1355,7 @@ - QComboBox::AdjustToContents + QComboBox::SizeAdjustPolicy::AdjustToContents @@ -1376,7 +1378,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1423,10 +1425,10 @@ true - QComboBox::InsertAtTop + QComboBox::InsertPolicy::InsertAtTop - QComboBox::AdjustToContents + QComboBox::SizeAdjustPolicy::AdjustToContents @@ -1454,7 +1456,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1525,10 +1527,10 @@ true - QAbstractItemView::SingleSelection + QAbstractItemView::SelectionMode::SingleSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows true @@ -1560,7 +1562,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1582,7 +1584,7 @@ - QFrame::Box + QFrame::Shape::Box Problem @@ -1679,7 +1681,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -1711,7 +1713,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -1752,19 +1754,19 @@ false - QAbstractItemView::InternalMove + QAbstractItemView::DragDropMode::InternalMove - Qt::MoveAction + Qt::DropAction::MoveAction true - QAbstractItemView::SingleSelection + QAbstractItemView::SelectionMode::SingleSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows 200 @@ -1862,7 +1864,7 @@ - QPlainTextEdit::NoWrap + QPlainTextEdit::LineWrapMode::NoWrap @@ -1875,7 +1877,7 @@ - QPlainTextEdit::NoWrap + QPlainTextEdit::LineWrapMode::NoWrap @@ -1888,7 +1890,7 @@ - QPlainTextEdit::NoWrap + QPlainTextEdit::LineWrapMode::NoWrap true @@ -1976,7 +1978,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -2562,7 +2564,7 @@ Open containing folder - Qt::ApplicationShortcut + Qt::ShortcutContext::ApplicationShortcut @@ -2667,7 +2669,7 @@ Ctrl+M - Qt::ApplicationShortcut + Qt::ShortcutContext::ApplicationShortcut @@ -3110,7 +3112,7 @@ Page Up - QAction::TextHeuristicRole + QAction::MenuRole::TextHeuristicRole @@ -3118,7 +3120,7 @@ Page Down - QAction::NoRole + QAction::MenuRole::NoRole @@ -3126,7 +3128,7 @@ Goto Line Start - QAction::NoRole + QAction::MenuRole::NoRole @@ -3134,7 +3136,7 @@ Goto Line End - QAction::NoRole + QAction::MenuRole::NoRole @@ -3142,7 +3144,7 @@ Goto File Start - QAction::NoRole + QAction::MenuRole::NoRole @@ -3150,7 +3152,7 @@ Goto File End - QAction::NoRole + QAction::MenuRole::NoRole @@ -3158,7 +3160,7 @@ Page Up and Select - QAction::NoRole + QAction::MenuRole::NoRole @@ -3166,7 +3168,7 @@ Page Down and Select - QAction::NoRole + QAction::MenuRole::NoRole @@ -3174,7 +3176,7 @@ Goto Page Start - QAction::NoRole + QAction::MenuRole::NoRole @@ -3182,7 +3184,7 @@ Goto Page End - QAction::NoRole + QAction::MenuRole::NoRole @@ -3190,7 +3192,7 @@ Goto Page Start and Select - QAction::NoRole + QAction::MenuRole::NoRole @@ -3198,7 +3200,7 @@ Goto Page End and Select - QAction::NoRole + QAction::MenuRole::NoRole @@ -3206,7 +3208,7 @@ Goto Line Start and Select - QAction::NoRole + QAction::MenuRole::NoRole @@ -3214,7 +3216,7 @@ Goto Line End and Select - QAction::NoRole + QAction::MenuRole::NoRole @@ -3222,7 +3224,7 @@ Goto File Start and Select - QAction::NoRole + QAction::MenuRole::NoRole @@ -3230,7 +3232,7 @@ Goto File End and Select - QAction::NoRole + QAction::MenuRole::NoRole @@ -3238,7 +3240,7 @@ Close Others - QAction::NoRole + QAction::MenuRole::NoRole @@ -3246,7 +3248,7 @@ OI Wiki - QAction::NoRole + QAction::MenuRole::NoRole @@ -3254,7 +3256,7 @@ Turtle Graphics Tutorial - QAction::NoRole + QAction::MenuRole::NoRole @@ -3265,7 +3267,18 @@ Ctrl+B - QAction::NoRole + QAction::MenuRole::NoRole + + + + + Code Completion + + + Ctrl+Shift+/ + + + QAction::MenuRole::NoRole diff --git a/RedPandaIDE/settingsdialog/environmentshortcutwidget.ui b/RedPandaIDE/settingsdialog/environmentshortcutwidget.ui index b2fa93e6..5e0bd839 100644 --- a/RedPandaIDE/settingsdialog/environmentshortcutwidget.ui +++ b/RedPandaIDE/settingsdialog/environmentshortcutwidget.ui @@ -32,7 +32,7 @@ - Search Actions + Filter Actions diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index 929c6753..4de97881 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -1420,7 +1420,7 @@ O texto a ser removido excede o limite de caracteres! - + Print Document Imprimir documento @@ -1458,7 +1458,7 @@ Apenas leitura - + Error Load File Erro ao carregar arquivo @@ -2661,7 +2661,7 @@ - Search Actions + Filter Actions @@ -4286,7 +4286,7 @@ Red Panda C++ - + Files Arquivos @@ -4424,8 +4424,8 @@ Expressão de endereço: - - + + Search @@ -4548,7 +4548,7 @@ ... - + File Arquivo @@ -4570,7 +4570,7 @@ - + @@ -5097,12 +5097,22 @@ Goto Declaration Declaração Goto + + + Code Completion + Complementar código + + + + Ctrl+Shift+/ + + Ctrl+Shift+G Ctrl+Shift+G - + Goto Definition Definição Goto @@ -7081,7 +7091,7 @@ - + Move Caret @@ -8817,7 +8827,7 @@ - + Code Generation Geração de código @@ -8830,7 +8840,7 @@ Otimizar menor, porém mantendo completa compatibilidade (-tune) - + Enable use of specific instructions (-mx) Habilitar uso de instruções específicar (-mx) @@ -8902,7 +8912,7 @@ Link para um programa Objective C (-lobjc) - + Do not use standard system libraries (-nostdlib) Não usar bibliotecas padrões do sistema (-nostdlib) @@ -8917,7 +8927,7 @@ Não gerar executável (-s) - + Generate debugging information (-g3) Gerar informação para depuração (-g3) @@ -8934,7 +8944,7 @@ Não montar, compilar e gerar código em assembly (-S) - + Use pipes instead of temporary files during compilation (-pipe) Usar pipes em lugar de arquivos temporários durante compilação (-pipe) @@ -9085,7 +9095,7 @@ - + C++ Language standard (-std) @@ -9155,7 +9165,7 @@ - + Processor (-m) @@ -9175,12 +9185,12 @@ - + Stack Size - + Use movc instead of movx to read from external ram diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index e0f73292..a9a8dd62 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -1678,7 +1678,7 @@ p, li { white-space: pre-wrap; } 十进制: %1 - + Print Document 打印文档 @@ -2966,8 +2966,12 @@ p, li { white-space: pre-wrap; } + Filter Actions + 过滤功能 + + Search Actions - 搜索功能 + 搜索功能 Keyword @@ -4667,7 +4671,7 @@ p, li { white-space: pre-wrap; } 小熊猫C++ - + @@ -4682,7 +4686,7 @@ p, li { white-space: pre-wrap; } 编译日志 - + File 文件 @@ -4693,18 +4697,18 @@ p, li { white-space: pre-wrap; } 工具 - + Run 运行 - + Edit 编辑 - + Project @@ -4774,8 +4778,8 @@ p, li { white-space: pre-wrap; } 局部变量 - - + + Search @@ -4807,13 +4811,13 @@ p, li { white-space: pre-wrap; } 关闭 - + Execute 运行 - + @@ -5108,12 +5112,12 @@ p, li { white-space: pre-wrap; } 单步进入 - + Move Caret 移动光标 - + Problem Set @@ -5559,12 +5563,22 @@ p, li { white-space: pre-wrap; } Goto Declaration 跳转到声明处 + + + Code Completion + 代码补全 + + + + Ctrl+Shift+/ + Ctrl+Shift+/ + Ctrl+Shift+G Ctrl+Shift+G - + Goto Definition 跳转到定义处 @@ -9275,7 +9289,7 @@ p, li { white-space: pre-wrap; } - + Code Generation 代码生成 @@ -9288,7 +9302,7 @@ p, li { white-space: pre-wrap; } 完整兼容特定机器,较少优化(-tune) - + Enable use of specific instructions (-mx) 启用特定指令集(-mx) @@ -9303,7 +9317,7 @@ p, li { white-space: pre-wrap; } 使用下列指针大小编译(-mx) - + Processor (-m) 处理器类型(-m) @@ -9316,7 +9330,7 @@ p, li { white-space: pre-wrap; } 性能分析 - + Generate debugging information (-g3) 生成调试信息(-g3) @@ -9384,12 +9398,12 @@ p, li { white-space: pre-wrap; } 检查是否严格遵守ISO C/C++标准 - + Stack Size 栈空间大小 - + Language standard (--std) C语言标准(--std) @@ -9473,7 +9487,7 @@ p, li { white-space: pre-wrap; } 检查ISO C/C++/C++0x语法一致性(-pedantic) - + Only check the code for syntax errors (-fsyntax-only) 只进行语法检查(不编译)(-fsyntax-only) @@ -9497,7 +9511,7 @@ p, li { white-space: pre-wrap; } 链接Objective-C程序 (-lobjc) - + Do not use standard system libraries (-nostdlib) 不使用标准库和系统启动文件(-nostdlib) diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index 2d7ca4ad..aaa8552e 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -1241,7 +1241,7 @@ - + Print Document @@ -1279,7 +1279,7 @@ - + Error Load File @@ -2422,7 +2422,7 @@ - Search Actions + Filter Actions @@ -4019,7 +4019,7 @@ - + Files @@ -4157,8 +4157,8 @@ - - + + Search @@ -4281,7 +4281,7 @@ - + File @@ -4303,7 +4303,7 @@ - + @@ -4824,7 +4824,17 @@ - + + Code Completion + + + + + Ctrl+Shift+/ + + + + Find references @@ -6654,7 +6664,7 @@ - + Move Caret @@ -8218,12 +8228,12 @@ - + Code Generation - + Enable use of specific instructions (-mx) @@ -8283,7 +8293,7 @@ - + Do not use standard system libraries (-nostdlib) @@ -8298,12 +8308,12 @@ - + Generate debugging information (-g3) - + Use pipes instead of temporary files during compilation (-pipe) @@ -8421,7 +8431,7 @@ - + C++ Language standard (-std) @@ -8491,7 +8501,7 @@ - + Processor (-m) @@ -8511,12 +8521,12 @@ - + Stack Size - + Use movc instead of movx to read from external ram diff --git a/Red_Panda_CPP.pro b/Red_Panda_CPP.pro index ff4a6e5d..4a48c1ce 100644 --- a/Red_Panda_CPP.pro +++ b/Red_Panda_CPP.pro @@ -24,19 +24,19 @@ include(version.inc) APP_VERSION = "$${APP_VERSION}$${APP_VERSION_SUFFIX}" } -win32: { -SUBDIRS += \ - redpanda-win-git-askpass -redpanda-win-git-askpass.subdir = tools/redpanda-win-git-askpass -RedPandaIDE.depends += redpanda-win-git-askpass -} +# win32: { +# SUBDIRS += \ +# redpanda-win-git-askpass +# redpanda-win-git-askpass.subdir = tools/redpanda-win-git-askpass +# RedPandaIDE.depends += redpanda-win-git-askpass +# } -unix: { -SUBDIRS += \ - redpanda-git-askpass - redpanda-git-askpass.subdir = tools/redpanda-git-askpass - RedPandaIDE.depends += redpanda-git-askpass -} +# unix: { +# SUBDIRS += \ +# redpanda-git-askpass +# redpanda-git-askpass.subdir = tools/redpanda-git-askpass +# RedPandaIDE.depends += redpanda-git-askpass +# } unix:!macos: { isEmpty(PREFIX) { diff --git a/libs/qsynedit/qsynedit_zh_CN.ts b/libs/qsynedit/qsynedit_zh_CN.ts index 06661511..0016f056 100644 --- a/libs/qsynedit/qsynedit_zh_CN.ts +++ b/libs/qsynedit/qsynedit_zh_CN.ts @@ -4288,7 +4288,7 @@ QSynedit::Document - + Can't open file '%1' for read! 无法读取文件"%1".