Skip to content

Bugfix - code completion with python servers#10

Merged
LakshyAAAgrawal merged 4 commits intomicrosoft:DanCip00/mainfrom
DanCip00:main
Dec 31, 2024
Merged

Bugfix - code completion with python servers#10
LakshyAAAgrawal merged 4 commits intomicrosoft:DanCip00/mainfrom
DanCip00:main

Conversation

@DanCip00
Copy link
Copy Markdown

@DanCip00 DanCip00 commented Oct 23, 2024

Removed extra await that blocks code completion for python Language Servers

Closes #9

Removed extra await that blocks code completion using Python Servers
@LakshyAAAgrawal
Copy link
Copy Markdown
Collaborator

Dear @DanCip00 ,

Thanks a lot for your PR! Have you been able to get pyright working with this change?

@DanCip00
Copy link
Copy Markdown
Author

Hi, I was trying to use your code to request completion in Python using Pyright and I ran into the same problem #10. Now it works fine for me. But now that I think about it maybe it's better to wrap the line around an if statement like this:

if self.language_id is not Language.PYTHON:
    await self.completions_available.wait()

@LakshyAAAgrawal
Copy link
Copy Markdown
Collaborator

LakshyAAAgrawal commented Oct 23, 2024

I would actually recommend creating a separate class for pyright, copying the full code for jedi, while modifying the following three lines: https://github.com/microsoft/multilspy/blob/main/src/multilspy/language_servers/jedi_language_server/jedi_server.py#L82C1-L84C49

These lines in the jedi client wait for jedi to report completions available, and sets the corresponding flag. Since it appears that this is not needed in pyright, you can directly make a call to this in start_server, before yielding.

Could you please make that change?

@LakshyAAAgrawal
Copy link
Copy Markdown
Collaborator

BTW, thanks a lot for this PR. I wasn't aware that this was the issue blocking pyright to work with multilspy. Thanks a lot for debugging this!

Please feel free to let me know iif I can help with anything on the PR.

@DanCip00
Copy link
Copy Markdown
Author

DanCip00 commented Oct 23, 2024

I am encountering the same issue of infinite waiting even when using jedi-language-server concerning the use of request_completions. I would like to ask you to verify if it works correctly for you :)

I am not an expert on the matter, but my hypothesis is that this call has not been implemented in the python-lsp-server library, on which the others are based. Is this possible?

Comment thread .gitignore
venv/ No newline at end of file
venv/

fake_repo/ No newline at end of file
Copy link
Copy Markdown
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/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you please add a setup_runtime_dependencies function here, so that users who do not have basedpyright installed in their environment can load it seamlessly?

Please let me know if you would like any help with this.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @DanCip00, Thanks a lot for the PR and I am sorry for getting back so late on this.

I believe the PR is in good shape. Would it be possible for you to just add the setup_runtime_dependencies for PyRight? If not, I could try to work on it and then immediately proceed with merging the PR.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think this resolves the issue with the pyright integration.
It still hangs on requests beyond initialization.

Comment thread src/multilspy/multilspy_config.py
@LakshyAAAgrawal
Copy link
Copy Markdown
Collaborator

@DanCip00 can you please accept the CLA?

@DanCip00
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@LakshyAAAgrawal LakshyAAAgrawal changed the base branch from main to DanCip00/main December 31, 2024 10:36
@LakshyAAAgrawal LakshyAAAgrawal merged commit 39d60e2 into microsoft:DanCip00/main Dec 31, 2024
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.

Stuck trying to launch pyright language server

4 participants