summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2016-08-21 15:27:53 +0200
committermathieui <mathieui@mathieui.net>2016-08-21 15:39:30 +0200
commit84e59b05ff0a17178da9ecdb6c5d084e48b42763 (patch)
tree224948d7c3d49a0005bff9390260357b3ec9c60e /doc
parent6c270b363ac018dfd4d66b23af95efcc35610da0 (diff)
downloadpoezio-84e59b05ff0a17178da9ecdb6c5d084e48b42763.tar.gz
poezio-84e59b05ff0a17178da9ecdb6c5d084e48b42763.tar.bz2
poezio-84e59b05ff0a17178da9ecdb6c5d084e48b42763.tar.xz
poezio-84e59b05ff0a17178da9ecdb6c5d084e48b42763.zip
Don’t call input completion() functions inside completion methods
Use a placeholder object that can run it afterwards, so that we don’t have side effects inside those functions.
Diffstat (limited to 'doc')
-rw-r--r--doc/source/dev/overview.rst10
1 files changed, 7 insertions, 3 deletions
diff --git a/doc/source/dev/overview.rst b/doc/source/dev/overview.rst
index fb880073..8711cbcd 100644
--- a/doc/source/dev/overview.rst
+++ b/doc/source/dev/overview.rst
@@ -88,9 +88,13 @@ structured as key (command name) -> tuple(command function, help string, complet
Completions are a bit tricky, but it’s easy once you get used to it:
They take an **Input** (a _windows_ class) as a parameter, named the_input
-everywhere in the sources. To effectively have a completion, you have to call
-**the_input.auto_completion()** or **the_input.new_completion()** with the relevant
-parameters before returning from the function.
+everywhere in the sources. To effectively have a completion, you have to create
+a :py:class:`poezio.core.structs.Completion` object initialized with the
+completion you want to call
+(**the_input.auto_completion()** or **the_input.new_completion()**) with the
+relevant parameters and return it with the function. Previously you would call
+the function directly from the completion method, but having side effects
+inside it makes it harder to test.
.. code-block:: python