- enhancement: add "minimum id length required to show code completion" to the options dialog's editor code completion page
This commit is contained in:
parent
3d9edcad57
commit
8edace1c1d
1
NEWS.md
1
NEWS.md
|
@ -4,6 +4,7 @@ Red Panda C++ Version 0.13.2
|
|||
- enhancement: can add non-code file in templates
|
||||
- enhancement: if there's no selection when copy/cut, select currect line by default
|
||||
- enhancement: support ligatures in fonts like fira code ( disabled by default, can be turned on in options dialog's editor font page)
|
||||
- enhancement: add "minimum id length required to show code completion" to the options dialog's editor code completion page
|
||||
|
||||
Red Panda C++ Version 0.13.1
|
||||
- enhancement: suppoort localization info in project templates
|
||||
|
|
|
@ -1205,10 +1205,10 @@ Are you really want to continue?</oldsource>
|
|||
<message>
|
||||
<location filename="editor.cpp" line="261"/>
|
||||
<location filename="editor.cpp" line="340"/>
|
||||
<location filename="editor.cpp" line="1198"/>
|
||||
<location filename="editor.cpp" line="1203"/>
|
||||
<location filename="editor.cpp" line="1221"/>
|
||||
<location filename="editor.cpp" line="1226"/>
|
||||
<location filename="editor.cpp" line="1196"/>
|
||||
<location filename="editor.cpp" line="1201"/>
|
||||
<location filename="editor.cpp" line="1219"/>
|
||||
<location filename="editor.cpp" line="1224"/>
|
||||
<source>Error</source>
|
||||
<translation>错误</translation>
|
||||
</message>
|
||||
|
@ -1222,65 +1222,65 @@ Are you really want to continue?</oldsource>
|
|||
<translation>另存为</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="1199"/>
|
||||
<location filename="editor.cpp" line="1197"/>
|
||||
<source>The text to be copied exceeds count limit!</source>
|
||||
<translation>要复制的内容超过了行数限制!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="1204"/>
|
||||
<location filename="editor.cpp" line="1202"/>
|
||||
<source>The text to be copied exceeds character limit!</source>
|
||||
<translation>要复制的内容超过了字符数限制!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="1222"/>
|
||||
<location filename="editor.cpp" line="1220"/>
|
||||
<source>The text to be cut exceeds count limit!</source>
|
||||
<translation>要剪切的内容超过了行数限制!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="1227"/>
|
||||
<location filename="editor.cpp" line="1225"/>
|
||||
<source>The text to be cut exceeds character limit!</source>
|
||||
<translation>要剪切的内容超过了字符数限制!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="2498"/>
|
||||
<location filename="editor.cpp" line="2496"/>
|
||||
<source>Print Document</source>
|
||||
<translation>打印文档</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="3074"/>
|
||||
<location filename="editor.cpp" line="3113"/>
|
||||
<location filename="editor.cpp" line="3164"/>
|
||||
<location filename="editor.cpp" line="3072"/>
|
||||
<location filename="editor.cpp" line="3111"/>
|
||||
<location filename="editor.cpp" line="3162"/>
|
||||
<source>Ctrl+click for more info</source>
|
||||
<translation>Ctrl+单击以获取更多信息</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="3551"/>
|
||||
<location filename="editor.cpp" line="3581"/>
|
||||
<location filename="editor.cpp" line="3549"/>
|
||||
<location filename="editor.cpp" line="3579"/>
|
||||
<source>Symbol '%1' not found!</source>
|
||||
<translation>未找到符号'%1'!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="3874"/>
|
||||
<location filename="editor.cpp" line="3872"/>
|
||||
<source>astyle not found</source>
|
||||
<translation>找不到astyle程序</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="3875"/>
|
||||
<location filename="editor.cpp" line="3873"/>
|
||||
<source>Can't find astyle in "%1".</source>
|
||||
<translation>找不到astyle程序"%1".</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="4020"/>
|
||||
<location filename="editor.cpp" line="4018"/>
|
||||
<source>Break point condition</source>
|
||||
<translation>断点条件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="4021"/>
|
||||
<location filename="editor.cpp" line="4019"/>
|
||||
<source>Enter the condition of the breakpoint:</source>
|
||||
<translation>输入当前断点的生效条件:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="editor.cpp" line="4231"/>
|
||||
<location filename="editor.cpp" line="4229"/>
|
||||
<source>Readonly</source>
|
||||
<translation>只读</translation>
|
||||
</message>
|
||||
|
@ -1436,72 +1436,77 @@ Are you really want to continue?</oldsource>
|
|||
<translation>启用代码补全</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="32"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="47"/>
|
||||
<source>Minimum id length to show completion </source>
|
||||
<translation>显示代码补全所需的标识符最短长度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="80"/>
|
||||
<source>Clear all parsed symbols when editor is hidden</source>
|
||||
<translation>清除不活动编辑器中的符号表(大幅减少内存占用)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="39"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="87"/>
|
||||
<source>Show completion suggestions while typing</source>
|
||||
<translation>输入时显示补全提示</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="46"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="94"/>
|
||||
<source>Engine options</source>
|
||||
<translation>引擎选项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="52"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="100"/>
|
||||
<source>Scan local header files</source>
|
||||
<translation>扫描本地头文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="59"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="107"/>
|
||||
<source>Scan system header files</source>
|
||||
<translation>扫描系统头文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="69"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="117"/>
|
||||
<source>Show keywords in suggestions</source>
|
||||
<translation>提示C/C++关键字</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="76"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="124"/>
|
||||
<source>Show code snippets in suggestions</source>
|
||||
<translation>提示用户自定义代码段</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="83"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="131"/>
|
||||
<source>Append () when complete functions</source>
|
||||
<translation>补全函数时自动添加()</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="90"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="138"/>
|
||||
<source>Ignore case when search suggestions</source>
|
||||
<translation>查找提示时忽略大小写</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="97"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="145"/>
|
||||
<source>Prefer local symbols</source>
|
||||
<translation>优先提示局部作用域中的符号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="119"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="167"/>
|
||||
<source>Prefer symbols mostly used</source>
|
||||
<translation>优先提示经常使用的符号</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="139"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="187"/>
|
||||
<source>Clear usage data</source>
|
||||
<translation>清除使用数据</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="158"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="206"/>
|
||||
<source>Completion suggestion window width:</source>
|
||||
<translation>补全提示窗口宽度:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="188"/>
|
||||
<location filename="settingsdialog/editorcodecompletionwidget.ui" line="236"/>
|
||||
<source>Completion suggestion window height:</source>
|
||||
<translation>补全提示窗口高度:</translation>
|
||||
</message>
|
||||
|
@ -7289,8 +7294,8 @@ Are you really want to continue?</oldsource>
|
|||
<context>
|
||||
<name>SynEdit</name>
|
||||
<message>
|
||||
<location filename="qsynedit/TextPainter.cpp" line="993"/>
|
||||
<location filename="qsynedit/TextPainter.cpp" line="994"/>
|
||||
<location filename="qsynedit/TextPainter.cpp" line="995"/>
|
||||
<source>The highlighter seems to be in an infinite loop</source>
|
||||
<translation>高亮处理进入了死循环</translation>
|
||||
</message>
|
||||
|
|
|
@ -701,14 +701,14 @@ void Editor::keyPressEvent(QKeyEvent *event)
|
|||
mLastIdCharPressed++;
|
||||
if (pSettings->codeCompletion().enabled()
|
||||
&& pSettings->codeCompletion().showCompletionWhileInput() ) {
|
||||
if (mLastIdCharPressed==1) {
|
||||
if (mParser && mParser->isIncludeLine(lineText())) {
|
||||
if (mParser && mParser->isIncludeLine(lineText())
|
||||
&& mLastIdCharPressed==pSettings->codeCompletion().minCharRequired()) {
|
||||
// is a #include line
|
||||
setSelText(ch);
|
||||
showHeaderCompletion(false);
|
||||
handled=true;
|
||||
return;
|
||||
} else {
|
||||
} else if (mLastIdCharPressed==pSettings->codeCompletion().minCharRequired()){
|
||||
QString lastWord = getPreviousWordAtPositionForSuggestion(caretXY());
|
||||
if (!lastWord.isEmpty()) {
|
||||
if (CppTypeKeywords.contains(lastWord)) {
|
||||
|
@ -748,8 +748,6 @@ void Editor::keyPressEvent(QKeyEvent *event)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
//preprocessor ?
|
||||
if ((mLastIdCharPressed=0) && (ch=='#') && lineText().isEmpty()) {
|
||||
|
@ -1151,7 +1149,7 @@ void Editor::inputMethodEvent(QInputMethodEvent *event)
|
|||
mLastIdCharPressed+=s.length();
|
||||
if (pSettings->codeCompletion().enabled()
|
||||
&& pSettings->codeCompletion().showCompletionWhileInput() ) {
|
||||
if (mLastIdCharPressed>=1) {
|
||||
if (mLastIdCharPressed>=pSettings->codeCompletion().minCharRequired()) {
|
||||
QString lastWord = getPreviousWordAtPositionForSuggestion(caretXY());
|
||||
if (!lastWord.isEmpty()) {
|
||||
if (CppTypeKeywords.contains(lastWord)) {
|
||||
|
|
|
@ -400,6 +400,7 @@ void SynEditTextPainter::PaintToken(const QString &Token, int TokenCols, int Col
|
|||
startPaint = false;
|
||||
for (int i=0;i<Token.length();i++) {
|
||||
int charCols;
|
||||
QString textToPaint = Token[i];
|
||||
if (Token[i] == SynTabChar) {
|
||||
charCols = edit->mTabWidth - ((ColumnsBefore+tokenColLen) % edit->mTabWidth);
|
||||
} else {
|
||||
|
|
|
@ -3479,6 +3479,16 @@ void Settings::CodeCompletion::setClearWhenEditorHidden(bool newClearWhenEditorH
|
|||
mClearWhenEditorHidden = newClearWhenEditorHidden;
|
||||
}
|
||||
|
||||
int Settings::CodeCompletion::minCharRequired() const
|
||||
{
|
||||
return mMinCharRequired;
|
||||
}
|
||||
|
||||
void Settings::CodeCompletion::setMinCharRequired(int newMinCharRequired)
|
||||
{
|
||||
mMinCharRequired = newMinCharRequired;
|
||||
}
|
||||
|
||||
bool Settings::CodeCompletion::appendFunc() const
|
||||
{
|
||||
return mAppendFunc;
|
||||
|
@ -3604,6 +3614,7 @@ void Settings::CodeCompletion::doSave()
|
|||
saveValue("append_func",mAppendFunc);
|
||||
saveValue("show_code_ins",mShowCodeIns);
|
||||
saveValue("clear_when_editor_hidden",mClearWhenEditorHidden);
|
||||
saveValue("min_char_required",mMinCharRequired);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3622,6 +3633,7 @@ void Settings::CodeCompletion::doLoad()
|
|||
mIgnoreCase = boolValue("ignore_case",true);
|
||||
mAppendFunc = boolValue("append_func",true);
|
||||
mShowCodeIns = boolValue("show_code_ins",true);
|
||||
mMinCharRequired = intValue("min_char_required",1);
|
||||
|
||||
bool doClear = true;
|
||||
|
||||
|
|
|
@ -576,6 +576,9 @@ public:
|
|||
bool clearWhenEditorHidden() const;
|
||||
void setClearWhenEditorHidden(bool newClearWhenEditorHidden);
|
||||
|
||||
int minCharRequired() const;
|
||||
void setMinCharRequired(int newMinCharRequired);
|
||||
|
||||
private:
|
||||
int mWidth;
|
||||
int mHeight;
|
||||
|
@ -590,6 +593,7 @@ public:
|
|||
bool mAppendFunc;
|
||||
bool mShowCodeIns;
|
||||
bool mClearWhenEditorHidden;
|
||||
int mMinCharRequired;
|
||||
|
||||
// _Base interface
|
||||
protected:
|
||||
|
|
|
@ -50,6 +50,8 @@ void EditorCodeCompletionWidget::doLoad()
|
|||
ui->chkIgnoreCases->setChecked(pSettings->codeCompletion().ignoreCase());
|
||||
ui->chkAppendFunc->setChecked(pSettings->codeCompletion().appendFunc());
|
||||
ui->chkShowCodeIns->setChecked(pSettings->codeCompletion().showCodeIns());
|
||||
|
||||
ui->spinMinCharRequired->setValue(pSettings->codeCompletion().minCharRequired());
|
||||
}
|
||||
|
||||
void EditorCodeCompletionWidget::doSave()
|
||||
|
@ -70,6 +72,8 @@ void EditorCodeCompletionWidget::doSave()
|
|||
pSettings->codeCompletion().setIgnoreCase(ui->chkIgnoreCases->isChecked());
|
||||
pSettings->codeCompletion().setAppendFunc(ui->chkAppendFunc->isChecked());
|
||||
pSettings->codeCompletion().setShowCodeIns(ui->chkShowCodeIns->isChecked());
|
||||
pSettings->codeCompletion().setMinCharRequired(ui->spinMinCharRequired->value());
|
||||
|
||||
|
||||
pSettings->codeCompletion().save();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,54 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Minimum id length to show completion </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinMinCharRequired">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkClearWhenEditorHidden">
|
||||
<property name="text">
|
||||
|
|
Loading…
Reference in New Issue