Skip to content
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

Bugfix - code completion with python servers #10

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,6 @@ src/multilspy/language_servers/typescript_language_server/static/

# Virtual Environment
.venv/
venv/
venv/

fake_repo/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Can you remove fake_repo/

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ from multilspy.multilspy_config import MultilspyConfig
from multilspy.multilspy_logger import MultilspyLogger
...
config = MultilspyConfig.from_dict({"code_language": "java"}) # Also supports "python", "rust", "csharp"
# config = MultilspyConfig.from_dict({"code_language": "python", 'python_server': 'jedi'}) # or pyright

logger = MultilspyLogger()
lsp = SyncLanguageServer.create(config, logger, "/abs/path/to/project/root/")
with lsp.start_server():
Expand Down
17 changes: 12 additions & 5 deletions src/multilspy/language_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,17 @@ def create(cls, config: MultilspyConfig, logger: MultilspyLogger, repository_roo
:return LanguageServer: A language specific LanguageServer instance.
"""
if config.code_language == Language.PYTHON:
from multilspy.language_servers.jedi_language_server.jedi_server import (
JediServer,
)
if config.python_server == 'pyright':
from multilspy.language_servers.pyright_language_server.pyright_server import (
PyRightServer,
)
return PyRightServer(config, logger, repository_root_path)
else:
from multilspy.language_servers.jedi_language_server.jedi_server import (
JediServer,
)
return JediServer(config, logger, repository_root_path)

return JediServer(config, logger, repository_root_path)
elif config.code_language == Language.JAVA:
from multilspy.language_servers.eclipse_jdtls.eclipse_jdtls import (
EclipseJDTLS,
Expand Down Expand Up @@ -497,7 +503,8 @@ async def request_completions(

num_retries = 0
while response is None or (response["isIncomplete"] and num_retries < 30):
await self.completions_available.wait()
if self.language_id != 'python':
await self.completions_available.wait()
response: Union[
List[LSPTypes.CompletionItem], LSPTypes.CompletionList, None
] = await self.server.send.completion(completion_params)
Expand Down
Loading