Repository: spyder-ide/spyder

Issue:
Automatic_completions* options not being set at startup
# Problem Description

I have the following non-default options configured in my `~/.spyder-py3-dev/config/spyder.ini`:
```
automatic_completions = True
automatic_completions_after_chars = 1
automatic_completions_after_ms = 100
```

The options are not being respected at startup (they are shown correctly in the preferences UI, but not respected by the editor).

But if I manually go and tweak the settings via the preferences UI and apply the changes, then the options are correctly propagated.


Discussion:

Resolving patch:
diff --git a/spyder/plugins/editor/plugin.py b/spyder/plugins/editor/plugin.py
--- a/spyder/plugins/editor/plugin.py
+++ b/spyder/plugins/editor/plugin.py
@@ -1226,8 +1226,10 @@ def register_editorstack(self, editorstack):
             ('set_convert_eol_on_save',             'convert_eol_on_save'),
             ('set_convert_eol_on_save_to',          'convert_eol_on_save_to'),
                     )
+
         for method, setting in settings:
             getattr(editorstack, method)(self.get_option(setting))
+
         editorstack.set_help_enabled(CONF.get('help', 'connect/editor'))
         editorstack.set_hover_hints_enabled(CONF.get('lsp-server',
                                                      'enable_hover_hints'))
diff --git a/spyder/plugins/editor/widgets/editor.py b/spyder/plugins/editor/widgets/editor.py
--- a/spyder/plugins/editor/widgets/editor.py
+++ b/spyder/plugins/editor/widgets/editor.py
@@ -552,6 +552,8 @@ def __init__(self, parent, actions):
         self.stripmode_enabled = False
         self.intelligent_backspace_enabled = True
         self.automatic_completions_enabled = True
+        self.automatic_completion_chars = 3
+        self.automatic_completion_ms = 300
         self.completions_hint_enabled = True
         self.hover_hints_enabled = True
         self.code_snippets_enabled = True
@@ -1180,13 +1182,13 @@ def set_automatic_completions_enabled(self, state):
                 finfo.editor.toggle_automatic_completions(state)
 
     def set_automatic_completions_after_chars(self, chars):
-        self.automatic_completions_after_chars = chars
+        self.automatic_completion_chars = chars
         if self.data:
             for finfo in self.data:
                 finfo.editor.set_automatic_completions_after_chars(chars)
 
     def set_automatic_completions_after_ms(self, ms):
-        self.automatic_completions_after_ms = ms
+        self.automatic_completion_ms = ms
         if self.data:
             for finfo in self.data:
                 finfo.editor.set_automatic_completions_after_ms(ms)
@@ -2417,6 +2419,8 @@ def create_new_editor(self, fname, enc, txt, set_current, new=False,
             strip_mode=self.stripmode_enabled,
             intelligent_backspace=self.intelligent_backspace_enabled,
             automatic_completions=self.automatic_completions_enabled,
+            automatic_completions_after_chars=self.automatic_completion_chars,
+            automatic_completions_after_ms=self.automatic_completion_ms,
             code_snippets=self.code_snippets_enabled,
             completions_hint=self.completions_hint_enabled,
             hover_hints=self.hover_hints_enabled,


Test patch: