Skip to content

Commit 5744bbe

Browse files
committed
Make the host find package dirs in "rplugin/python3"
Add handling for the old workaround
1 parent f427d0a commit 5744bbe

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

neovim/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ def start_host(session=None):
3939
_, ext = os.path.splitext(arg)
4040
if ext == '.py':
4141
plugins.append(arg)
42+
elif os.path.isdir(arg):
43+
init = os.path.join(arg, '__init__.py')
44+
if os.path.isfile(init):
45+
plugins.append(arg)
46+
47+
# This is a special case to support the old workaround of
48+
# adding an empty .py file to make a package directory
49+
# visible, and it should be removed soon.
50+
for path in list(plugins):
51+
dup = path + ".py"
52+
if os.path.isdir(path) and dup in plugins:
53+
plugins.remove(dup)
4254

4355
if not plugins:
4456
sys.exit('must specify at least one plugin as argument')

neovim/plugin/host.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def _copy_attributes(self, fn, fn2):
183183
def _on_specs_request(self, path):
184184
if IS_PYTHON3 and isinstance(path, bytes):
185185
path = path.decode(self._nvim_encoding)
186-
return self._specs.get(path, [])
186+
return self._specs.get(path, 0)
187187

188188
def _decodehook_for(self, encoding):
189189
if IS_PYTHON3 and encoding is None:

0 commit comments

Comments
 (0)