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

LSP Client: Accept floats with trailing zeros as valid JSONRPC IDs #12376

Conversation

samuelselleck
Copy link
Contributor

This solves #12367

I'm not particularly familiar with serde, but couldn't find a way of only accepting the trailing suffix ".0". Instead of stripping ".0" this tries to parse the id as a serde_json::Number and accepts either a u64 or a f64 with zero fractional parts (.0, .00, .000, etc.).

@samuelselleck samuelselleck force-pushed the samsel/jsonrpc-number-fractions branch from 72c740c to 976cd72 Compare December 31, 2024 14:54
@the-mikedavis the-mikedavis linked an issue Dec 31, 2024 that may be closed by this pull request
`u64::MAX as f64` is actually a number higher than `u64::MAX`:

    18,446,744,073,709,552,000 >
    18,446,744,073,709,551,615

so it's not an effective gate to reject floats that are too large. We're
unlikely to ever see a float come in that is larger than `u64::MAX` so
we can drop this check for the sake of simplicity.

Also removed a level of nesting and added a comment for context.
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

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

thanks!

@the-mikedavis the-mikedavis changed the title LSP Client: Accept floats with trailing zeros as valid JSONRPC IDs. LSP Client: Accept floats with trailing zeros as valid JSONRPC IDs Dec 31, 2024
@the-mikedavis the-mikedavis merged commit 4a59f68 into helix-editor:master 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.

LSP Client: id handling requires certain number serialization
2 participants