Skip to content

SyncLanguageServer.create - small documentation note #87

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

Merged
merged 1 commit into from
Mar 27, 2025

Conversation

Andrej730
Copy link
Contributor

To clarify that relative paths for repositories are not supported.

Currently if it's using relative path, create_server fails with traceback similar to the one below:

Traceback (most recent call last):
  File "third_test.py", line 11, in <module>
    with lsp.start_server():
  File "\Python311\Lib\contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "\Python311\Lib\site-packages\multilspy\language_server.py", line 744, in start_server
    asyncio.run_coroutine_threadsafe(ctx.__aenter__(), loop=self.loop).result()
  File "\Python311\Lib\concurrent\futures\_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "\Python311\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "\Python311\Lib\contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "\Python311\Lib\site-packages\multilspy\language_servers\jedi_language_server\jedi_server.py", line 101, in start_server
    initialize_params = self._get_initialize_params(self.repository_root_path)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\Python311\Lib\site-packages\multilspy\language_servers\jedi_language_server\jedi_server.py", line 50, in _get_initialize_params
    d["rootUri"] = pathlib.Path(repository_absolute_path).as_uri()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\Python311\Lib\pathlib.py", line 566, in as_uri
    raise ValueError("relative path can't be expressed as a file URI")
ValueError: relative path can't be expressed as a file URI

To clarify that relative paths for repositories are not supported.

Currently if it's using relative path, `create_server` fails with traceback similar to the one below:
```python
Traceback (most recent call last):
  File "third_test.py", line 11, in <module>
    with lsp.start_server():
  File "\Python311\Lib\contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "\Python311\Lib\site-packages\multilspy\language_server.py", line 744, in start_server
    asyncio.run_coroutine_threadsafe(ctx.__aenter__(), loop=self.loop).result()
  File "\Python311\Lib\concurrent\futures\_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "\Python311\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "\Python311\Lib\contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "\Python311\Lib\site-packages\multilspy\language_servers\jedi_language_server\jedi_server.py", line 101, in start_server
    initialize_params = self._get_initialize_params(self.repository_root_path)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\Python311\Lib\site-packages\multilspy\language_servers\jedi_language_server\jedi_server.py", line 50, in _get_initialize_params
    d["rootUri"] = pathlib.Path(repository_absolute_path).as_uri()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\Python311\Lib\pathlib.py", line 566, in as_uri
    raise ValueError("relative path can't be expressed as a file URI")
ValueError: relative path can't be expressed as a file URI
```
@LakshyAAAgrawal LakshyAAAgrawal merged commit ebc65d8 into microsoft:main Mar 27, 2025
4 checks passed
@Andrej730 Andrej730 deleted the ls_create_note branch March 27, 2025 18:22
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

Successfully merging this pull request may close these issues.

2 participants