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

Stuck trying to launch pyright language server #9

Open
maths-lover opened this issue Oct 21, 2024 · 5 comments · May be fixed by #10
Open

Stuck trying to launch pyright language server #9

maths-lover opened this issue Oct 21, 2024 · 5 comments · May be fixed by #10

Comments

@maths-lover
Copy link

maths-lover commented Oct 21, 2024

I do a simple copy of jedi-language-server, replace jedi calls to pyright, everything seems to work except the request goes to stdin (not sure if they actually do) but no response comes back.

A demo can be seen in the following asciicast

Please provide me insight if I'm doing something wrong here.

Thank you!

@maths-lover
Copy link
Author

Ah, and I forgot to mention that with jedi it worked fine without any issue.

@DanCip00
Copy link

#10 I think this solves your problem 💪

@LakshyAAAgrawal LakshyAAAgrawal linked a pull request Oct 23, 2024 that will close this issue
@maths-lover
Copy link
Author

maths-lover commented Nov 4, 2024

@DanCip00 I don't see much difference, it still gets stuck for me when I try to make some request to the lsp server.

I did notice the following,

                if self.language_id != "python":
                    await self.completions_available.wait()

But while I was debugging it never got stuck there, it gets stuck when I make a "request/defintion" and such.

For one use case (it happens in possibly all other) I've pinpointed to the following position,

        with self.open_file(relative_file_path):
            # sending request to the language server and waiting for response
            response = await self.server.send.definition(
                {
                    LSPConstants.TEXT_DOCUMENT: {
                        LSPConstants.URI: pathlib.Path(
                            str(PurePath(self.repository_root_path, relative_file_path))
                        ).as_uri()
                    },
                    LSPConstants.POSITION: {
                        LSPConstants.LINE: line,
                        LSPConstants.CHARACTER: column,
                    },
                }
            )
            print("Stuck here?")

that print("Stuck here") which I added, was never called in

    async def request_definition(
        self, relative_file_path: str, line: int, column: int
    ) -> List[multilspy_types.Location]:

method in language_server.py

@maths-lover
Copy link
Author

For some reason, the asyncio.Condition() doesn't get released.

@LakshyAAAgrawal
Copy link
Collaborator

Hi @maths-lover and @DanCip00,

I apologize for getting back so late on this. @maths-lover could you please confirm if @DanCip00's fix works now? If yes, could you please contribute a unittest for your specific situation, and I will merge both the unittest and solution PRs?

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 a pull request may close this issue.

3 participants