[rkward] rkward: Add settings to control completion
Thomas Friedrichsmeier
null at kde.org
Fri Feb 22 12:01:52 GMT 2019
Git commit 1e11f49f514223bd632010da696c70676e5d0070 by Thomas Friedrichsmeier.
Committed on 22/02/2019 at 12:01.
Pushed by tfry into branch 'master'.
Add settings to control completion
M +92 -80 rkward/settings/rksettingsmodulecommandeditor.cpp
M +30 -12 rkward/settings/rksettingsmodulecommandeditor.h
M +14 -15 rkward/windows/rkcodecompletion.cpp
https://commits.kde.org/rkward/1e11f49f514223bd632010da696c70676e5d0070
diff --git a/rkward/settings/rksettingsmodulecommandeditor.cpp b/rkward/settings/rksettingsmodulecommandeditor.cpp
index 49988939..51d1f799 100644
--- a/rkward/settings/rksettingsmodulecommandeditor.cpp
+++ b/rkward/settings/rksettingsmodulecommandeditor.cpp
@@ -20,9 +20,10 @@
#include <kconfig.h>
#include <kconfiggroup.h>
-#include <qlayout.h>
-#include <qlabel.h>
+#include <QLabel>
#include <QVBoxLayout>
+#include <QGridLayout>
+#include <QFormLayout>
#include <QCheckBox>
#include <QGroupBox>
#include <QLineEdit>
@@ -35,11 +36,12 @@
#include "../debug.h"
// static members
-int RKSettingsModuleCommandEditor::completion_min_chars;
-int RKSettingsModuleCommandEditor::completion_timeout;
-bool RKSettingsModuleCommandEditor::completion_enabled;
+int RKSettingsModuleCommandEditor::auto_completion_min_chars;
+int RKSettingsModuleCommandEditor::auto_completion_timeout;
+bool RKSettingsModuleCommandEditor::auto_completion_enabled;
+bool RKSettingsModuleCommandEditor::completion_type_enabled[RKSettingsModuleCommandEditor::N_COMPLETION_CATEGORIES];
int RKSettingsModuleCommandEditor::completion_options;
-bool RKSettingsModuleCommandEditor::arghinting_enabled;
+bool RKSettingsModuleCommandEditor::cursor_navigates_completions;
bool RKSettingsModuleCommandEditor::autosave_enabled;
bool RKSettingsModuleCommandEditor::autosave_keep;
int RKSettingsModuleCommandEditor::autosave_interval;
@@ -55,58 +57,55 @@ RKSettingsModuleCommandEditor::RKSettingsModuleCommandEditor (RKSettings *gui, Q
main_vbox->addWidget (label);
main_vbox->addSpacing (2 * RKGlobals::spacingHint ());
- QGroupBox* group = new QGroupBox (i18n ("Code Completion"), this);
+ QGroupBox* group = new QGroupBox (i18n ("Code Completion / Code Hints"), this);
QVBoxLayout* box_layout = new QVBoxLayout (group);
- completion_enabled_box = new QCheckBox (i18n ("Enable code completion"), group);
- completion_enabled_box->setChecked (completion_enabled);
- connect (completion_enabled_box, &QCheckBox::stateChanged, this, &RKSettingsModuleCommandEditor::settingChanged);
- box_layout->addWidget (completion_enabled_box);
+ QGridLayout *g_layout = new QGridLayout ();
+ box_layout->addLayout (g_layout);
+ makeCompletionTypeBoxes (QStringList () << i18n ("Function call tip") << i18n ("Function argument completion") << i18n ("Object name completion") << i18n ("Filename completion") << i18n ("Auto word completion"), g_layout);
+
+ auto_completion_enabled_box = new QGroupBox (i18n ("Start code completions/hints, automatically"), group);
+ auto_completion_enabled_box->setCheckable (true);
+ auto_completion_enabled_box->setChecked (auto_completion_enabled);
+ connect (auto_completion_enabled_box, &QGroupBox::toggled, this, &RKSettingsModuleCommandEditor::settingChanged);
+ box_layout->addWidget (auto_completion_enabled_box);
+
+ QFormLayout* form_layout = new QFormLayout (auto_completion_enabled_box);
+ auto_completion_min_chars_box = new RKSpinBox (auto_completion_enabled_box);
+ auto_completion_min_chars_box->setIntMode (1, INT_MAX, auto_completion_min_chars);
+ auto_completion_min_chars_box->setEnabled (auto_completion_enabled);
+ connect (auto_completion_min_chars_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &RKSettingsModuleCommandEditor::settingChanged);
+ form_layout->addRow ("Minimum number of characters", auto_completion_min_chars_box);
+
+ auto_completion_timeout_box = new RKSpinBox (auto_completion_enabled_box);
+ auto_completion_timeout_box->setIntMode (0, INT_MAX, auto_completion_timeout);
+ auto_completion_timeout_box->setEnabled (auto_completion_enabled);
+ connect (auto_completion_timeout_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &RKSettingsModuleCommandEditor::settingChanged);
+ form_layout->addRow (i18n ("Timeout (milliseconds)"), auto_completion_timeout_box);
+
+ form_layout = new QFormLayout ();
+ box_layout->addLayout (form_layout);
+
+ cursor_navigates_completions_box = new QCheckBox (i18n ("Up/down cursor keys navigate completion items"));
+ cursor_navigates_completions_box->setChecked (cursor_navigates_completions);
+ RKCommonFunctions::setTips (i18n ("Should the up / down cursor keys be used to navigate among the completion items, while code completion is active? If this option is unchecked, Alt+up/down will navigate completion items, while up / down will behave as if no completion was active."), cursor_navigates_completions_box);
+ connect (cursor_navigates_completions_box, &QCheckBox::stateChanged, this, &RKSettingsModuleCommandEditor::settingChanged);
+ form_layout->addRow (cursor_navigates_completions_box);
- box_layout->addSpacing (RKGlobals::spacingHint ());
-
- label = new QLabel (i18n ("Minimum number of characters before completion is attempted"), group);
- label->setWordWrap (true);
- completion_min_chars_box = new RKSpinBox (group);
- completion_min_chars_box->setIntMode (1, INT_MAX, completion_min_chars);
- completion_min_chars_box->setEnabled (completion_enabled);
- connect (completion_min_chars_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &RKSettingsModuleCommandEditor::settingChanged);
- box_layout->addWidget (label);
- box_layout->addWidget (completion_min_chars_box);
-
- main_vbox->addSpacing (RKGlobals::spacingHint ());
-
- label = new QLabel (i18n ("Timeout (milliseconds) before completion is attempted"), group);
- label->setWordWrap (true);
- completion_timeout_box = new RKSpinBox (group);
- completion_timeout_box->setIntMode (0, INT_MAX, completion_timeout);
- completion_timeout_box->setEnabled (completion_enabled);
- connect (completion_timeout_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &RKSettingsModuleCommandEditor::settingChanged);
- box_layout->addWidget (label);
- box_layout->addWidget (completion_timeout_box);
-
- label = new QLabel (i18nc ("Note: list() and data.frame() are programming terms in R, and should not be translated, here", "Operator for access to members of list() and data.frame() objects"));
- label->setWordWrap (true);
completion_list_member_operator_box = new QComboBox (group);
completion_list_member_operator_box->addItem (i18n ("'$'-operator (list$member)"));
completion_list_member_operator_box->addItem (i18n ("'[['-operator (list[[\"member\"]])"));
completion_list_member_operator_box->setCurrentIndex ((completion_options & RObject::DollarExpansion) ? 0 : 1);
connect (completion_list_member_operator_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &RKSettingsModuleCommandEditor::settingChanged);
- box_layout->addWidget (label);
- box_layout->addWidget (completion_list_member_operator_box);
+ form_layout->addRow (i18nc ("Note: list() and data.frame() are programming terms in R, and should not be translated, here", "Operator for access to members of list() and data.frame() objects"), completion_list_member_operator_box);
- label = new QLabel (i18nc ("Note: S4-slot() is a programming term in R, and should not be translated, here", "Operator for access to S4-slot()s"));
- label->setWordWrap (true);
completion_slot_operator_box = new QComboBox (group);
completion_slot_operator_box->addItem (i18n ("'@'-operator (object at smember)"));
completion_slot_operator_box->addItem (i18n ("'slot()'-function (slot(object, member))"));
completion_slot_operator_box->setCurrentIndex ((completion_options & RObject::ExplicitSlotsExpansion) ? 1 : 0);
connect (completion_slot_operator_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &RKSettingsModuleCommandEditor::settingChanged);
- box_layout->addWidget (label);
- box_layout->addWidget (completion_slot_operator_box);
+ form_layout->addRow (i18nc ("Note: S4-slot() is a programming term in R, and should not be translated, here", "Operator for access to S4-slot()s"), completion_slot_operator_box);
- label = new QLabel (i18n ("Include environment for objects on the search path:"));
- label->setWordWrap (true);
completion_object_qualification_box = new QComboBox (group);
completion_object_qualification_box->addItem (i18n ("For masked objects, only"));
completion_object_qualification_box->addItem (i18n ("For objects outside of <i>.GlobalEnv</i>, only"));
@@ -116,60 +115,45 @@ RKSettingsModuleCommandEditor::RKSettingsModuleCommandEditor (RKSettings *gui, Q
else completion_object_qualification_box->setCurrentIndex (1);
}
connect (completion_object_qualification_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &RKSettingsModuleCommandEditor::settingChanged);
- box_layout->addWidget (label);
- box_layout->addWidget (completion_object_qualification_box);
+ form_layout->addRow (i18n ("Include environment for objects on the search path:"), completion_object_qualification_box);
main_vbox->addWidget (group);
- arghinting_enabled_box = new QCheckBox (i18n ("Enable function argument hinting"), group);
- arghinting_enabled_box->setChecked (arghinting_enabled);
- connect (arghinting_enabled_box, &QCheckBox::stateChanged, this, &RKSettingsModuleCommandEditor::settingChanged);
- main_vbox->addWidget (arghinting_enabled_box);
-
main_vbox->addSpacing (2 * RKGlobals::spacingHint ());
group = autosave_enabled_box = new QGroupBox (i18n ("Autosaves"), this);
autosave_enabled_box->setCheckable (true);
autosave_enabled_box->setChecked (autosave_enabled);
connect (autosave_enabled_box, &QGroupBox::toggled, this, &RKSettingsModuleCommandEditor::settingChanged);
- box_layout = new QVBoxLayout (group);
+ form_layout = new QFormLayout (group);
- label = new QLabel (i18n ("Autosave interval (minutes)"), group);
autosave_interval_box = new RKSpinBox (group);
autosave_interval_box->setIntMode (1, INT_MAX, autosave_interval);
connect (autosave_interval_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &RKSettingsModuleCommandEditor::settingChanged);
- box_layout->addWidget (label);
- box_layout->addWidget (autosave_interval_box);
- box_layout->addSpacing (RKGlobals::spacingHint ());
+ form_layout->addRow (i18n ("Autosave interval (minutes)"), autosave_interval_box);
autosave_keep_box = new QCheckBox (i18n ("Keep autosave file after manual save"), group);
autosave_keep_box->setChecked (autosave_keep);
connect (autosave_keep_box, &QCheckBox::stateChanged, this, &RKSettingsModuleCommandEditor::settingChanged);
- box_layout->addWidget (autosave_keep_box);
+ form_layout->addRow (autosave_keep_box);
main_vbox->addWidget (group);
main_vbox->addSpacing (2 * RKGlobals::spacingHint ());
group = new QGroupBox (i18n ("Opening script files"), this);
- box_layout = new QVBoxLayout (group);
- label = new QLabel (i18n ("Number of scripts in recent file lists (*)"), group);
+ form_layout = new QFormLayout (group);
num_recent_files_box = new RKSpinBox (group);
num_recent_files_box->setIntMode (1, INT_MAX, num_recent_files);
RKCommonFunctions::setTips (i18n ("<p>The number of recent files to remember (in the Open Recent R Script File menu).</p>") + RKCommonFunctions::noteSettingsTakesEffectAfterRestart (), num_recent_files_box, label);
connect (num_recent_files_box, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &RKSettingsModuleCommandEditor::settingChanged);
- box_layout->addWidget (label);
- box_layout->addWidget (num_recent_files_box);
- box_layout->addSpacing (RKGlobals::spacingHint ());
+ form_layout->addRow (i18n ("Number of scripts in recent file lists (*)"), num_recent_files_box);
- label = new QLabel (i18n ("R script file filters (separated by spaces)"), group);
script_file_filter_box = new QLineEdit (group);
script_file_filter_box->setText (script_file_filter);
RKCommonFunctions::setTips (i18n ("<p>A list of filters (file name extensions) that should be treated as R script files. Most importantly, files matching one of these filters will always be opened with R syntax highlighting.</p><p>Filters are case insensitive.</p>"), script_file_filter_box, label);
connect (script_file_filter_box, &QLineEdit::textChanged, this, &RKSettingsModuleCommandEditor::settingChanged);
- box_layout->addWidget (label);
- box_layout->addWidget (script_file_filter_box);
- box_layout->addSpacing (RKGlobals::spacingHint ());
+ form_layout->addRow (i18n ("R script file filters (separated by spaces)"), script_file_filter_box);
main_vbox->addWidget (group);
@@ -180,12 +164,20 @@ RKSettingsModuleCommandEditor::~RKSettingsModuleCommandEditor () {
RK_TRACE (SETTINGS);
}
+void RKSettingsModuleCommandEditor::makeCompletionTypeBoxes (const QStringList& labels, QGridLayout* layout) {
+ RK_ASSERT (labels.count () == N_COMPLETION_CATEGORIES);
+ for (int i = 0; i < N_COMPLETION_CATEGORIES; ++i) {
+ QCheckBox *box = new QCheckBox(labels[i]);
+ box->setChecked (completion_type_enabled[i]);
+ completion_type_enabled_box[i] = box;
+ layout->addWidget (completion_type_enabled_box[i], i / 2, i % 2);
+ connect (box, &QCheckBox::stateChanged, this, &RKSettingsModuleCommandEditor::settingChanged);
+ }
+}
+
void RKSettingsModuleCommandEditor::settingChanged () {
RK_TRACE (SETTINGS);
change ();
-
- completion_timeout_box->setEnabled (completion_enabled_box->isChecked ());
- completion_min_chars_box->setEnabled (completion_enabled_box->isChecked ());
}
QString RKSettingsModuleCommandEditor::caption () {
@@ -196,10 +188,14 @@ QString RKSettingsModuleCommandEditor::caption () {
void RKSettingsModuleCommandEditor::applyChanges () {
RK_TRACE (SETTINGS);
- completion_enabled = completion_enabled_box->isChecked ();
- completion_min_chars = completion_min_chars_box->intValue ();
- completion_timeout = completion_timeout_box->intValue ();
- arghinting_enabled = arghinting_enabled_box->isChecked ();
+ auto_completion_enabled = auto_completion_enabled_box->isChecked ();
+ auto_completion_min_chars = auto_completion_min_chars_box->intValue ();
+ auto_completion_timeout = auto_completion_timeout_box->intValue ();
+ for (int i = 0; i < N_COMPLETION_CATEGORIES; ++i) {
+ completion_type_enabled[i] = completion_type_enabled_box[i]->isChecked ();
+ }
+ cursor_navigates_completions = cursor_navigates_completions_box->isChecked ();
+
completion_options = 0;
if (completion_list_member_operator_box->currentIndex () == 0) completion_options += RObject::DollarExpansion;
if (completion_slot_operator_box->currentIndex () == 1) completion_options += RObject::ExplicitSlotsExpansion;
@@ -220,15 +216,28 @@ void RKSettingsModuleCommandEditor::save (KConfig *config) {
saveSettings (config);
}
+QString completionTypeToConfigKey (int cat) {
+ if (cat == RKSettingsModuleCommandEditor::Calltip) return "Calltips";
+ if (cat == RKSettingsModuleCommandEditor::Arghint) return "Argument completion";
+ if (cat == RKSettingsModuleCommandEditor::Object) return "Object completion";
+ if (cat == RKSettingsModuleCommandEditor::Filename) return "Filename completion";
+ if (cat == RKSettingsModuleCommandEditor::AutoWord) return "Auto word completion";
+ RK_ASSERT(false);
+ return QString ();
+}
+
void RKSettingsModuleCommandEditor::saveSettings (KConfig *config) {
RK_TRACE (SETTINGS);
KConfigGroup cg = config->group ("Command Editor Windows");
- cg.writeEntry ("Completion enabled", completion_enabled);
- cg.writeEntry ("Completion min chars", completion_min_chars);
- cg.writeEntry ("Completion timeout", completion_timeout);
+ cg.writeEntry ("Completion enabled", auto_completion_enabled);
+ cg.writeEntry ("Completion min chars", auto_completion_min_chars);
+ cg.writeEntry ("Completion timeout", auto_completion_timeout);
cg.writeEntry ("Completion option flags", completion_options);
- cg.writeEntry ("Argument hinting enabled", arghinting_enabled);
+ cg.writeEntry ("Cursor navigate completions", cursor_navigates_completions);
+ for (int i = 0; i < N_COMPLETION_CATEGORIES; ++i) {
+ cg.writeEntry (completionTypeToConfigKey (i), completion_type_enabled[i]);
+ }
cg.writeEntry ("Autosave enabled", autosave_enabled);
cg.writeEntry ("Autosave keep saves", autosave_keep);
@@ -242,11 +251,14 @@ void RKSettingsModuleCommandEditor::loadSettings (KConfig *config) {
RK_TRACE (SETTINGS);
KConfigGroup cg = config->group ("Command Editor Windows");
- completion_enabled = cg.readEntry ("Completion enabled", true);
- completion_min_chars = cg.readEntry ("Completion min chars", 2);
- completion_timeout = cg.readEntry ("Completion timeout", 500);
+ auto_completion_enabled = cg.readEntry ("Completion enabled", true);
+ auto_completion_min_chars = cg.readEntry ("Completion min chars", 2);
+ auto_completion_timeout = cg.readEntry ("Completion timeout", 250);
completion_options = cg.readEntry ("Completion option flags", (int) RObject::IncludeEnvirIfMasked);
- arghinting_enabled = cg.readEntry ("Argument hinting enabled", true);
+ cursor_navigates_completions = cg.readEntry ("Cursor navigate completions", false);
+ for (int i = 0; i < N_COMPLETION_CATEGORIES; ++i) {
+ completion_type_enabled[i] = cg.readEntry (completionTypeToConfigKey (i), true);
+ }
autosave_enabled = cg.readEntry ("Autosave enabled", true);
autosave_keep = cg.readEntry ("Autosave keep saves", false);
diff --git a/rkward/settings/rksettingsmodulecommandeditor.h b/rkward/settings/rksettingsmodulecommandeditor.h
index 0fbae0c4..d29b685e 100644
--- a/rkward/settings/rksettingsmodulecommandeditor.h
+++ b/rkward/settings/rksettingsmodulecommandeditor.h
@@ -24,6 +24,7 @@ class QCheckBox;
class QLineEdit;
class QGroupBox;
class QComboBox;
+class QGridLayout;
/**
configuration for the Command Editor windows
@@ -45,12 +46,23 @@ public:
QString caption () override;
+ enum CompletionCategories {
+ Calltip = 0,
+ Arghint,
+ Object,
+ Filename,
+ AutoWord,
+ N_COMPLETION_CATEGORIES
+ };
+
/// min number of character to try code completion
- static int completionMinChars () { return completion_min_chars; };
- static int completionTimeout () { return completion_timeout; };
- static bool completionEnabled () { return completion_enabled; };
- static bool argHintingEnabled () { return arghinting_enabled; };
+ static int autoCompletionMinChars () { return auto_completion_min_chars; };
+ static int autoCompletionTimeout () { return auto_completion_timeout; };
+ static bool autoCompletionEnabled () { return auto_completion_enabled; };
+ static bool argHintingEnabled () { return isCompletionEnabled (Arghint); }; // TODO: remove me
static int completionOptions () { return completion_options; };
+ static bool isCompletionEnabled (CompletionCategories cat) { return completion_type_enabled[cat]; };
+ static bool cursorNavigatesCompletions () { return cursor_navigates_completions; };
static bool autosaveEnabled () { return autosave_enabled; };
static bool autosaveKeep () { return autosave_keep; };
@@ -63,16 +75,22 @@ public:
public slots:
void settingChanged ();
private:
- static int completion_min_chars;
- static int completion_timeout;
- static bool completion_enabled;
- static bool arghinting_enabled;
+ void makeCompletionTypeBoxes (const QStringList& label, QGridLayout* layout);
+
+ static int auto_completion_min_chars;
+ static int auto_completion_timeout;
+ static bool auto_completion_enabled;
+ static bool completion_type_enabled[N_COMPLETION_CATEGORIES];
+ static bool cursor_navigates_completions;
+
+ RKSpinBox* auto_completion_min_chars_box;
+ RKSpinBox* auto_completion_timeout_box;
+ QGroupBox* auto_completion_enabled_box;
+ QCheckBox* completion_type_enabled_box[N_COMPLETION_CATEGORIES];
+ QCheckBox* cursor_navigates_completions_box;
+
static int completion_options;
- RKSpinBox* completion_min_chars_box;
- RKSpinBox* completion_timeout_box;
- QCheckBox* completion_enabled_box;
- QCheckBox* arghinting_enabled_box;
QComboBox* completion_list_member_operator_box;
QComboBox* completion_slot_operator_box;
QComboBox* completion_object_qualification_box;
diff --git a/rkward/windows/rkcodecompletion.cpp b/rkward/windows/rkcodecompletion.cpp
index e10d880a..9e4508de 100644
--- a/rkward/windows/rkcodecompletion.cpp
+++ b/rkward/windows/rkcodecompletion.cpp
@@ -83,14 +83,11 @@ RKCompletionManager::~RKCompletionManager () {
}
void RKCompletionManager::tryCompletionProxy () {
- if (RKSettingsModuleCommandEditor::completionEnabled ()) {
- if (active) {
- // Handle this in the next event cycle, as more than one event may trigger
- completion_timer->start (0);
- // TODO: Actually, in this case we should try to _update_ the existing completion, i.e. try to save some CPU cycles.
- tryCompletion ();
- }
- completion_timer->start (RKSettingsModuleCommandEditor::completionTimeout ());
+ if (active) {
+ // Handle this in the next event cycle, as more than one event may trigger
+ completion_timer->start (0);
+ } else if (RKSettingsModuleCommandEditor::autoCompletionEnabled ()) {
+ completion_timer->start (RKSettingsModuleCommandEditor::autoCompletionTimeout ());
}
}
@@ -139,7 +136,7 @@ void RKCompletionManager::tryCompletion () {
}
QString word = currentCompletionWord ();
- if (user_triggered || (word.length () >= RKSettingsModuleCommandEditor::completionMinChars ())) {
+ if (user_triggered || (word.length () >= RKSettingsModuleCommandEditor::autoCompletionMinChars ())) {
QString filename;
// as a very simple heuristic: If the current symbol starts with a quote, we should probably attempt file name completion, instead of symbol name completion
if (word.startsWith ('\"') || word.startsWith ('\'') || word.startsWith ('`')) {
@@ -250,17 +247,17 @@ void RKCompletionManager::updateVisibility () {
active_models.clear ();
}
- bool min_len = (currentCompletionWord ().length () >= RKSettingsModuleCommandEditor::completionMinChars ()) || user_triggered;
- startModel (cc_iface, completion_model, min_len, symbol_range, &active_models);
- startModel (cc_iface, file_completion_model, min_len, symbol_range, &active_models);
- if (kate_keyword_completion_model) {
+ bool min_len = (currentCompletionWord ().length () >= RKSettingsModuleCommandEditor::autoCompletionMinChars ()) || user_triggered;
+ startModel (cc_iface, completion_model, min_len && RKSettingsModuleCommandEditor::isCompletionEnabled (RKSettingsModuleCommandEditor::Object), symbol_range, &active_models);
+ startModel (cc_iface, file_completion_model, min_len && RKSettingsModuleCommandEditor::isCompletionEnabled (RKSettingsModuleCommandEditor::Filename), symbol_range, &active_models);
+ if (kate_keyword_completion_model && RKSettingsModuleCommandEditor::isCompletionEnabled (RKSettingsModuleCommandEditor::AutoWord)) {
// Model needs to update, first, as we have not handled it in tryCompletion:
if (min_len) kate_keyword_completion_model->completionInvoked (view (), symbol_range, KTextEditor::CodeCompletionModel::ManualInvocation);
startModel (cc_iface, kate_keyword_completion_model, min_len, symbol_range, &active_models);
}
// NOTE: Freaky bug in KF 5.44.0: Call hint will not show for the first time, if logically above the primary screen. TODO: provide patch for kateargumenthinttree.cpp:166pp
- startModel (cc_iface, callhint_model, true, currentCallRange (), &active_models);
- startModel (cc_iface, arghint_model, (currentCompletionWord ().length () >= RKSettingsModuleCommandEditor::completionMinChars ()) || user_triggered, argname_range, &active_models);
+ startModel (cc_iface, callhint_model, true && RKSettingsModuleCommandEditor::isCompletionEnabled (RKSettingsModuleCommandEditor::Calltip), currentCallRange (), &active_models);
+ startModel (cc_iface, arghint_model, min_len && RKSettingsModuleCommandEditor::isCompletionEnabled (RKSettingsModuleCommandEditor::Arghint), argname_range, &active_models);
if (!active_models.isEmpty ()) {
active = true;
@@ -354,6 +351,8 @@ bool RKCompletionManager::eventFilter (QObject* watched, QEvent* event) {
return true;
}
} else if ((k->key () == Qt::Key_Up || k->key () == Qt::Key_Down) && cc_iface->isCompletionActive ()) {
+ if (RKSettingsModuleCommandEditor::cursorNavigatesCompletions ()) return false;
+
// Make up / down-keys (without alt) navigate in the document (aborting the completion)
// Meke alt+up / alt+down naviate in the completion list
if (k->modifiers () & Qt::AltModifier) {
More information about the rkward-tracker
mailing list