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

Allow both integer and string request IDs in LSP #7662

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

mprihoda
Copy link
Contributor

Zed's LSP support expects request messages to have integer ID, Metals LSP uses string. According to specification, both is acceptable:

interface RequestMessage extends Message {

/**
 * The request id.
 */
id: integer | string;

...
This pull requests modifies the types and serialization/deserialization so that string IDs are accepted.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 10, 2024
Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

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

Thank you for separating it out of the Scala PR, this seems quite a fundamental change indeed to have it mixed with the other ones.

I'm curious to know how Scala LSP is supposed to react to our integer IDs sent and mixed with the string ones?
I expect no issues as long as those are unique and there's no overlap with the server ones (that we do not ensure anyway now, so seems tolerable), but is it true?

@mprihoda
Copy link
Contributor Author

mprihoda commented Feb 11, 2024

I'm curious to know how Scala LSP is supposed to react to our integer IDs sent and mixed with the string ones?
I expect no issues as long as those are unique and there's no overlap with the server ones (that we do not ensure anyway now, so seems tolerable), but is it true?

Metals works just fine with the integer IDs generated by Zed, it returns the integer back correctly.

@maxdeviant maxdeviant changed the title Allow both integer and string request ids in LSP. Allow both integer and string request IDs in LSP Feb 12, 2024
@SomeoneToIgnore SomeoneToIgnore self-assigned this Feb 12, 2024
@mprihoda mprihoda force-pushed the wip/lsp-string-id branch 2 times, most recently from ee12d47 to c3a7b73 Compare February 14, 2024 22:19
Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

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

Beautiful, thank you for finally making us spec-compliant on that front.

I see an odd CI error and wondering if you could rebase on a fresh main?
If that would not fix it, I'll just merge it since it seems unrelated, but let's be on a safe side.

@SomeoneToIgnore
Copy link
Contributor

Yes, here's the commit we want to pull into: #7803

@mprihoda
Copy link
Contributor Author

Rebased, and improved the commit messages while I've been at it.

@SomeoneToIgnore SomeoneToIgnore merged commit f01763a into zed-industries:main Feb 15, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants