[education/rkward] /: Start moving to a more serious completion of dynamic completions
Thomas Friedrichsmeier
null at kde.org
Wed Oct 5 16:33:03 BST 2022
Git commit 5ed900b63c014d8965b0ac8773f0e04bfdacd215 by Thomas Friedrichsmeier.
Committed on 18/07/2022 at 20:21.
Pushed by tfry into branch 'master'.
Start moving to a more serious completion of dynamic completions
M +1 -1 VERSION.cmake
M +2 -1 rkward/rbackend/rpackages/rkward/DESCRIPTION
M +7 -16 rkward/windows/rkcodecompletion.cpp
https://invent.kde.org/education/rkward/commit/5ed900b63c014d8965b0ac8773f0e04bfdacd215
diff --git a/VERSION.cmake b/VERSION.cmake
index ab15a4ec..b7e80c59 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -1,3 +1,3 @@
# DO NOT CHANGE THIS FILE MANUALLY!
# It will be overwritten by scripts/set_dist_version.sh
-SET(RKVERSION_NUMBER 0.7.4z+0.7.5+devel3)
+SET(RKVERSION_NUMBER 0.7.4z+0.7.5+devel4)
diff --git a/rkward/rbackend/rpackages/rkward/DESCRIPTION b/rkward/rbackend/rpackages/rkward/DESCRIPTION
index 836fc703..21c5d866 100755
--- a/rkward/rbackend/rpackages/rkward/DESCRIPTION
+++ b/rkward/rbackend/rpackages/rkward/DESCRIPTION
@@ -18,7 +18,7 @@ Authors at R: c(person(given="Thomas", family="Friedrichsmeier",
role=c("aut")), person(family="the RKWard team",
email="rkward-devel at kde.org", role=c("cre","aut")))
Version: 0.7.5
-Date: 2022-06-14
+Date: 2022-07-18
RoxygenNote: 7.1.2
Collate:
'base_overrides.R'
@@ -29,6 +29,7 @@ Collate:
'public_graphics.R'
'rk.KDE_GUI-functions.R'
'rk.check.for.pandoc.R'
+ 'rk.completion-functions.R'
'rk.demo.R'
'rk.edit-functions.R'
'rk.filename-functions.R'
diff --git a/rkward/windows/rkcodecompletion.cpp b/rkward/windows/rkcodecompletion.cpp
index 72c93530..c1823505 100644
--- a/rkward/windows/rkcodecompletion.cpp
+++ b/rkward/windows/rkcodecompletion.cpp
@@ -768,23 +768,14 @@ void RKArgumentHintModel::updateCompletionList (RObject* _function, const QStrin
void RKArgumentHintModel::fetchRCompletions() {
RK_TRACE(COMMANDEDITOR);
+
+ if (r_completions_function != nullptr) {
+ // an old (now obsolete) query is still running. Wait for it to complete, first, avoiding to stack up (pontentially costly) calls
+ return;
+ }
+
r_completions_function = function;
- RCommand *command = new RCommand("local({\n"
- " f <- function(fname) {\n"
- " oldrcs <- utils::rc.settings()\n"
- " oldrcopts <- utils::rc.options()\n"
- " on.exit({do.call(utils::rc.settings, as.list(oldrcs)); utils::rc.options(oldrcopts)})\n"
- " utils::rc.settings(ops=FALSE, ns=FALSE, args=TRUE, dots=FALSE, func=FALSE, ipck=FALSE, S3=TRUE, data=FALSE, help=FALSE, argdb=TRUE, fuzzy=FALSE, quotes=FALSE, files=FALSE)\n"
- " utils::rc.options(funarg.suffix=\"\")\n"
- " utils:::.assignLinebuffer(paste0(fname, \"(\"))\n"
- " utils:::.assignToken(\"\")\n"
- " utils:::.assignStart(nchar(fname)+1)\n"
- " utils:::.assignEnd(nchar(fname)+1)\n"
- " utils:::.completeToken()\n"
- " utils:::.retrieveCompletions()\n"
- " }\n"
- " f(\"plot\")\n"
- "})\n", RCommand::Sync | RCommand::PriorityCommand | RCommand::GetStringVector);
+ RCommand *command = new RCommand(QString("rkward:::.rk.completions(%1, \"funargs\")").arg(function->getShortName()), RCommand::Sync | RCommand::PriorityCommand | RCommand::GetStringVector);
command->whenFinished(this, [this](RCommand *command) {
if (r_completions_function != function) {
QTimer::singleShot(0, this, &RKArgumentHintModel::fetchRCompletions);
More information about the rkward-tracker
mailing list