Skip to content

Goto definition does not work, when you want to jump from a package in virtualenv into a submodule #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
diefans opened this issue Jan 10, 2018 · 5 comments

Comments

@diefans
Copy link

diefans commented Jan 10, 2018

2018-01-10 16:09:04,519 UTC - ERROR - pyls.language_server - CAUGHT
Traceback (most recent call last):
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/language_server.py", line 65, in wrapped
    return func(*args, **kwargs)
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 144, in m_text_document__definition
    return self.definitions(textDocument['uri'], position)
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 79, in definitions
    return flatten(self._hook('pyls_definitions', doc_uri, position=position))
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 27, in _hook
    doc = self.workspace.get_document(doc_uri) if doc_uri else None
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/workspace.py", line 110, in get_document
    return self._docs[doc_uri]
KeyError: 'file:///home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py'
2018-01-10 16:09:04,520 UTC - ERROR - jsonrpc.manager - API Exception: {'type': 'KeyError', 'args': ('file:///home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py',), 'message': "'file:///home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py'"}
Traceback (most recent call last):
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/jsonrpc/manager.py", line 112, in _get_responses
    result = method(*request.args, **request.kwargs)
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/language_server.py", line 65, in wrapped
    return func(*args, **kwargs)
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 144, in m_text_document__definition
    return self.definitions(textDocument['uri'], position)
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 79, in definitions
    return flatten(self._hook('pyls_definitions', doc_uri, position=position))
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 27, in _hook
    doc = self.workspace.get_document(doc_uri) if doc_uri else None
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/workspace.py", line 110, in get_document
    return self._docs[doc_uri]
KeyError: 'file:///home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py'

Steps to reproduce:

#       v jump to this
import yaml
#       v jump to this
from .error import *

from .tokens import *
from .events import *
# ...

Apparently the put_document resp. m_text_document__did_open is not called (only for sources installed in my virtual env, my development files are working), where I have no clue how this is invoked...

I am using neovim with LanguageClient-neovim plugin

@gatesn
Copy link
Contributor

gatesn commented Jan 10, 2018

@diefans can you paste more of the log? Ideally running pyls with -vv as an argument

@diefans
Copy link
Author

diefans commented Jan 10, 2018

The get doc log is inserted by myself. When everything works, put_document is called when neovim jumps to the definition, which is missing here (no put doc log)...

2018-01-10 22:05:13,556 UTC - INFO - pyls.language_server - Starting PythonLanguageServer IO language server
2018-01-10 22:05:13,556 UTC - DEBUG - pyls.server - Got message: b'{"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"completion":{"completionItem":{"commitCharactersSupport":null,"documentationFormat":null,"snippetSupport":false},"dynamicRegistration":null}}},"initializationOptions":null,"processId":27989,"rootPath":"/home/code/da/dbltr/src/debellator","rootUri":"file:///home/code/da/dbltr/src/debellator","trace":"off"},"id":8}'
2018-01-10 22:05:13,556 UTC - DEBUG - pyls.language_server - Language server intialized with {'capabilities': {'textDocument': {'completion': {'completionItem': {'commitCharactersSupport': None, 'documentationFormat': None, 'snippetSupport': False}, 'dynamicRegistration': None}}}, 'initializationOptions': None, 'processId': 27989, 'rootPath': '/home/code/da/dbltr/src/debellator', 'rootUri': 'file:///home/code/da/dbltr/src/debellator', 'trace': 'off'}
2018-01-10 22:05:13,770 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_completion from <module 'pyls.plugins.jedi_completion' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/jedi_completion.py'>
2018-01-10 22:05:13,770 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_definition from <module 'pyls.plugins.definition' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/definition.py'>
2018-01-10 22:05:13,770 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_hover from <module 'pyls.plugins.hover' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/hover.py'>
2018-01-10 22:05:13,770 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_references from <module 'pyls.plugins.references' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/references.py'>
2018-01-10 22:05:13,771 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_signature_help from <module 'pyls.plugins.signature' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/signature.py'>
2018-01-10 22:05:13,771 UTC - INFO - pyls.config.config - Loaded pyls plugin jedi_symbols from <module 'pyls.plugins.symbols' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/symbols.py'>
2018-01-10 22:05:13,771 UTC - INFO - pyls.config.config - Loaded pyls plugin mccabe from <module 'pyls.plugins.mccabe_lint' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/mccabe_lint.py'>
2018-01-10 22:05:13,771 UTC - INFO - pyls.config.config - Loaded pyls plugin pycodestyle from <module 'pyls.plugins.pycodestyle_lint' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/pycodestyle_lint.py'>
2018-01-10 22:05:13,771 UTC - INFO - pyls.config.config - Loaded pyls plugin pydocstyle from <module 'pyls.plugins.pydocstyle_lint' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/pydocstyle_lint.py'>
2018-01-10 22:05:13,771 UTC - INFO - pyls.config.config - Loaded pyls plugin pyflakes from <module 'pyls.plugins.pyflakes_lint' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/pyflakes_lint.py'>
2018-01-10 22:05:13,771 UTC - INFO - pyls.config.config - Loaded pyls plugin rope_completion from <module 'pyls.plugins.rope_completion' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/rope_completion.py'>
2018-01-10 22:05:13,771 UTC - INFO - pyls.config.config - Loaded pyls plugin rope_rename from <module 'pyls.plugins.rope_rename' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/rope_rename.py'>
2018-01-10 22:05:13,771 UTC - INFO - pyls.config.config - Loaded pyls plugin yapf from <module 'pyls.plugins.format' from '/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/plugins/format.py'>
2018-01-10 22:05:13,771 UTC - DEBUG - pyls.config.config -   pyls_settings [hook]
      config: <pyls.config.config.Config object at 0x7f08371d7e80>

2018-01-10 22:05:13,771 UTC - DEBUG - pyls.config.config -   finish pyls_settings --> [{'plugins': {'pydocstyle': {'enabled': False}}}] [hook]

2018-01-10 22:05:13,771 UTC - DEBUG - pyls.config.config -   pyls_initialize [hook]
      config: <pyls.config.config.Config object at 0x7f08371d7e80>
      workspace: <pyls.workspace.Workspace object at 0x7f08371d7be0>
      document: None

2018-01-10 22:05:13,771 UTC - DEBUG - pyls.config.config -   finish pyls_initialize --> [] [hook]

2018-01-10 22:05:13,771 UTC - DEBUG - pyls.config.config -   pyls_commands [hook]
      config: <pyls.config.config.Config object at 0x7f08371d7e80>
      workspace: <pyls.workspace.Workspace object at 0x7f08371d7be0>
      document: None

2018-01-10 22:05:13,771 UTC - DEBUG - pyls.config.config -   finish pyls_commands --> [] [hook]

2018-01-10 22:05:13,773 UTC - DEBUG - pyls.server - Got message: b'{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"python","text":"\\"\\"\\"CLI scripts.\\"\\"\\"\\nimport asyncio\\nimport logging\\nimport logging.config\\nimport threading\\n\\nimport click\\nimport pkg_resources\\nimport yaml\\n\\nlog = logging.getLogger(__name__)\\n\\n\\ndef run():\\n    return cli(obj={}, auto_envvar_prefix=\'DEBELLATOR\')\\n\\n\\n@click.group(invoke_without_command=True)\\n@click.option(\'event_loop\', \'--loop\', default=\'asyncio\',\\n              type=click.Choice((\'asyncio\', \'uvloop\', \'tokio\')),\\n              help=\'Use uvloop policy.\')\\n@click.option(\'--debug/--no-debug\', default=False, help=\'Enable or disable debug.\')\\n@click.option(\'--log-config\',\\n              type=click.File(\'r\'),\\n              default=None,\\n              help=\'Logging configuration in yaml format.\')\\n@click.option(\'--remote-log-config\',\\n              type=click.File(\'r\'),\\n              default=None,\\n              help=\'Logging configuration in yaml format.\')\\n# @click.option(\'--config\', \'-c\', default=None, help=\'General configuration.\')\\n@click.pass_context\\ndef cli(ctx, event_loop, debug, log_config, remote_log_config):\\n    if log_config is None:\\n        log_config = pkg_resources.resource_string(\'debellator\', \'logging.yaml\')\\n\\n    if remote_log_config is None:\\n        remote_log_config = pkg_resources.resource_string(\'debellator\', \'remote-logging.yaml\')\\n\\n    log_config = yaml.load(log_config)\\n    remote_log_config = yaml.load(remote_log_config)\\n    logging.config.dictConfig(log_config)\\n\\n    if event_loop == \'uvloop\':\\n        try:\\n            import uvloop\\n            asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())\\n            log.info(\\"Using uvloop event loop policy\\")\\n\\n        except ImportError:\\n            log.warning(\\"uvloop is not available.\\")\\n\\n    elif event_loop == \'tokio\':\\n        try:\\n            import tokio\\n            asyncio.set_event_loop_policy(tokio.EventLoopPolicy())\\n            log.info(\\"Using tokio event loop policy\\")\\n\\n        except ImportError:\\n            log.warning(\\"tokio is not available.\\")\\n\\n    if ctx.invoked_subcommand is None:\\n        # we need to import master lazy because master imports core,\\n        # which may use exclusive decorator, which tries to get the actual loop,\\n        # which is only set after running set_event_loop_policy\\n        from debellator import master\\n\\n        if debug:\\n            log.info(\\"Enable asyncio debug\\")\\n            master.core.log.setLevel(logging.DEBUG)\\n            asyncio.get_event_loop().set_debug(debug)\\n\\n        master.main(log_config=remote_log_config, debug=debug)\\n\\n    else:\\n        if debug:\\n            asyncio.get_event_loop().set_debug(debug)\\n            log.setLevel(logging.DEBUG)\\n\\n    ctx.obj[\'log_config\'] = log_config\\n    ctx.obj[\'remote_log_config\'] = remote_log_config\\n    ctx.obj[\'debug\'] = debug\\n\\n\\n@cli.command(\'cmd\')\\n@click.argument(\'dotted_command_name\')\\n@click.argument(\'command_params_file\', type=click.File(\'rb\'))\\n@click.option(\'-r\', \'--remote\', help=\'The remote connection\')\\n@click.pass_context\\ndef cli_cmd(ctx, dotted_command_name, command_params_file, remote):\\n    \\"\\"\\"Execute a :py:obj:`debellator.core.Command` in a remote process.\\n\\n    DOTTED_COMMAND_NAME is the path to a debellator command,\\n    e.g.: foo.bar.module:CommandClass\\n    \\"\\"\\"\\n    import importlib\\n    from debellator import core, connect\\n\\n    # lookup command\\n    module_name, command_name = dotted_command_name.split(\':\')\\n    module = importlib.import_module(module_name)\\n    command_cls = getattr(module, command_name)\\n    assert issubclass(command_cls, core.Command), \\\\\\n        \'{} is not a subclass of {}\'.format(dotted_command_name, core.Command)\\n\\n    connector = connect.Connector.create_connector(remote)\\n    command_params = yaml.load(command_params_file.read())\\n\\n    options = {\\n        \'log_config\': ctx.obj[\'remote_log_config\'],\\n        \'debug\': ctx.obj[\'debug\']\\n    }\\n    pool = RemotesPool(options)\\n\\n    loop = asyncio.get_event_loop()\\n    print(\'main loop\', id(loop))\\n    # see https://docs.python.org/3/library/asyncio-subprocess.html#subprocess-and-threads\\n    # see https://github.com/python/asyncio/issues/390#issuecomment-235915330\\n    policy = asyncio.get_event_loop_policy()\\n    watcher = asyncio.SafeChildWatcher()\\n    watcher.attach_loop(loop)\\n    policy.set_child_watcher(watcher)\\n\\n    loop.run_until_complete(run_pool(pool, connector, command_cls, command_params))\\n    loop.stop()\\n    loop.close()\\n\\n\\nasync def run_pool(pool, connector, command_cls, command_params):\\n    # connect\\n    loop = pool.get_next_loop()\\n    future = asyncio.run_coroutine_threadsafe(pool.connect(connector), loop)\\n    remote = future.result()\\n\\n    future = asyncio.run_coroutine_threadsafe(remote.execute(command_cls, **command_params), loop)\\n    result = future.result()\\n    print(\\"RESULT:\\", result)\\n\\n    # loop.call_soon_threadsafe(pool.worker.evt_shutdown.set)\\n    # print(\\"*\\" * 100, \\"shutdown\\")\\n    future = asyncio.run_coroutine_threadsafe(pool.shutdown(), loop)\\n    # result = future.result()\\n    # print(\' JOIN \', * 5)\\n    pool.worker.thread.join()\\n\\n\\nclass RemotesPool:\\n    def __init__(self, options):\\n        self.options = options or {}\\n        self.remotes = {}\\n\\n        self.worker = Worker()\\n        self.worker.start()\\n\\n    def get_next_loop(self):\\n        \\"\\"\\"Start nect thread and return its loop.\\"\\"\\"\\n        return self.worker.loop\\n\\n    async def log_remote_stderr(self, remote):\\n        \\"\\"\\"Just log remote stderr.\\"\\"\\"\\n        # await remote.launched()\\n        if remote.stderr:\\n            log.info(\\"Logging remote stderr: %s\\", remote)\\n            async for line in remote.stderr:\\n                log.debug(\\"\\\\tRemote #%s: %s\\", remote.pid, line[:-1].decode())\\n\\n    async def connect(self, connector, **kwargs):\\n        \\"\\"\\"Connect to a remote and pool it.\\"\\"\\"\\n        loop = asyncio.get_event_loop()\\n        print(\'thread loop\', id(loop))\\n        if connector in self.remotes:\\n            remote, _, _ = self.remotes[connector]\\n            log.warning(\'Process for %s already launched! Using: %s\',\\n                        connector, remote)\\n        else:\\n            remote = await connector.launch(\\n                options=self.options, **kwargs,\\n                loop=loop\\n            )\\n            fut_remote = asyncio.ensure_future(\\n                remote.communicate(), loop=loop)\\n            error_log = asyncio.ensure_future(\\n                self.log_remote_stderr(remote), loop=loop)\\n            self.remotes[connector] = (remote, fut_remote, error_log)\\n\\n        return remote\\n\\n    async def shutdown(self):\\n        loop = asyncio.get_event_loop()\\n        for remote, fut_remote, error_log in self.remotes.values():\\n            loop.call_soon_threadsafe(fut_remote.cancel)\\n            await fut_remote\\n            loop.call_soon_threadsafe(error_log.cancel)\\n            await error_log\\n        loop.call_soon_threadsafe(self.worker.evt.evt_shutdown.set)\\n\\n\\nclass Worker:\\n    def __init__(self):\\n        self.thread = threading.Thread(target=self._run_event_loop_forever)\\n        self.loop = asyncio.new_event_loop()\\n        self.evt_shutdown = asyncio.Event(loop=self.loop)\\n\\n    def _run_event_loop_forever(self):\\n        asyncio.set_event_loop(self.loop)\\n        self.loop.run_until_complete(self.evt_shutdown.wait())\\n        self.loop.stop()\\n\\n    def start(self):\\n        self.thread.start()","uri":"file:///home/code/da/dbltr/src/debellator/scripts.py","version":0}}}'
2018-01-10 22:05:13,774 UTC - INFO - pyls.workspace - put doc: file:///home/code/da/dbltr/src/debellator/scripts.py
2018-01-10 22:05:13,774 UTC - INFO - pyls.workspace - get doc: file:///home/code/da/dbltr/src/debellator/scripts.py
2018-01-10 22:05:13,774 UTC - DEBUG - pyls.config.config -   pyls_document_did_open [hook]
      config: <pyls.config.config.Config object at 0x7f08371d7e80>
      workspace: <pyls.workspace.Workspace object at 0x7f08371d7be0>
      document: file:///home/code/da/dbltr/src/debellator/scripts.py

2018-01-10 22:05:13,775 UTC - DEBUG - pyls.config.config -   finish pyls_document_did_open --> [] [hook]

2018-01-10 22:05:14,275 UTC - INFO - pyls.workspace - get doc: file:///home/code/da/dbltr/src/debellator/scripts.py
2018-01-10 22:05:14,275 UTC - DEBUG - pyls.config.config -   pyls_lint [hook]
      config: <pyls.config.config.Config object at 0x7f08371d7e80>
      workspace: <pyls.workspace.Workspace object at 0x7f08371d7be0>
      document: file:///home/code/da/dbltr/src/debellator/scripts.py

2018-01-10 22:05:16,841 UTC - DEBUG - pyls.server - Got message: b'{"jsonrpc":"2.0","method":"textDocument/definition","params":{"position":{"character":8,"line":8},"textDocument":{"uri":"file:///home/code/da/dbltr/src/debellator/scripts.py"}},"id":13}'
2018-01-10 22:05:16,842 UTC - INFO - pyls.workspace - get doc: file:///home/code/da/dbltr/src/debellator/scripts.py
2018-01-10 22:05:16,842 UTC - DEBUG - pyls.config.config -   pyls_definitions [hook]
      config: <pyls.config.config.Config object at 0x7f08371d7e80>
      workspace: <pyls.workspace.Workspace object at 0x7f08371d7be0>
      document: file:///home/code/da/dbltr/src/debellator/scripts.py
      position: {'character': 8, 'line': 8}

2018-01-10 22:05:16,842 UTC - INFO - pyls.workspace - Using virtualenv /home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3
2018-01-10 22:05:16,916 UTC - DEBUG - parso.cache - pickle loaded: /home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py
2018-01-10 22:05:16,917 UTC - DEBUG - pyls.config.config -   finish pyls_definitions --> [[{'uri': 'file:///home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py', 'range': {'start': {'line': 0, 'character': 0}, 'end': {'line': 0, 'character': 4}}}]] [hook]

2018-01-10 22:05:19,986 UTC - DEBUG - pyls.server - Got message: b'{"jsonrpc":"2.0","method":"textDocument/definition","params":{"position":{"character":8,"line":1},"textDocument":{"uri":"file:///home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py"}},"id":15}'
2018-01-10 22:05:19,987 UTC - INFO - pyls.workspace - get doc: file:///home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py
2018-01-10 22:05:19,987 UTC - ERROR - pyls.language_server - CAUGHT
Traceback (most recent call last):
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/language_server.py", line 65, in wrapped
    return func(*args, **kwargs)
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 144, in m_text_document__definition
    return self.definitions(textDocument['uri'], position)
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 79, in definitions
    return flatten(self._hook('pyls_definitions', doc_uri, position=position))
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 27, in _hook
    doc = self.workspace.get_document(doc_uri) if doc_uri else None
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/workspace.py", line 111, in get_document
    return self._docs[doc_uri]
KeyError: 'file:///home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py'
2018-01-10 22:05:19,988 UTC - ERROR - jsonrpc.manager - API Exception: {'type': 'KeyError', 'args': ('file:///home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py',), 'message': "'file:///home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py'"}
Traceback (most recent call last):
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/jsonrpc/manager.py", line 112, in _get_responses
    result = method(*request.args, **request.kwargs)
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/language_server.py", line 65, in wrapped
    return func(*args, **kwargs)
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 144, in m_text_document__definition
    return self.definitions(textDocument['uri'], position)
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 79, in definitions
    return flatten(self._hook('pyls_definitions', doc_uri, position=position))
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/python_ls.py", line 27, in _hook
    doc = self.workspace.get_document(doc_uri) if doc_uri else None
  File "/home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/pyls/workspace.py", line 111, in get_document
    return self._docs[doc_uri]
KeyError: 'file:///home/olli/.pyenv/versions/3.6.3/envs/dbltr-3.6.3/lib/python3.6/site-packages/yaml/__init__.py'

@gatesn
Copy link
Contributor

gatesn commented Jan 14, 2018

I can't seem to re-create this error with the VSCode client. Which client are you using? As you say, it seems to be missing the textDocument/didOpen message?

@diefans
Copy link
Author

diefans commented Mar 15, 2018

I am using neovim with https://github.com/autozimu/LanguageClient-neovim

@diefans
Copy link
Author

diefans commented Mar 27, 2018

My issue seems fixed so far. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants