mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
fix add_bracket_after_function had no effect (#1297)
* fix add_bracket_after_function had no effect * added test for fix * using monkeypatch to set add_bracket_after_function.
This commit is contained in:
committed by
Dave Halter
parent
c801e24afc
commit
e843c6108d
@@ -397,7 +397,7 @@ class Completion(BaseDefinition):
|
||||
def _complete(self, like_name):
|
||||
append = ''
|
||||
if settings.add_bracket_after_function \
|
||||
and self.type == 'Function':
|
||||
and self.type == 'function':
|
||||
append = '('
|
||||
|
||||
if self._name.api_type == 'param' and self._stack is not None:
|
||||
|
||||
@@ -21,3 +21,14 @@ def test_add_dynamic_mods(Script):
|
||||
result = script.goto_definitions()
|
||||
assert len(result) == 1
|
||||
assert result[0].description == 'class int'
|
||||
|
||||
|
||||
def test_add_bracket_after_function(monkeypatch, Script):
|
||||
settings = api.settings
|
||||
monkeypatch.setattr(settings, 'add_bracket_after_function', True)
|
||||
script = Script('''\
|
||||
def foo():
|
||||
pass
|
||||
foo''')
|
||||
completions = script.completions()
|
||||
assert completions[0].complete == '('
|
||||
|
||||
Reference in New Issue
Block a user