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

Use maxBound of uinteger not Int. #2169

Merged
merged 8 commits into from
Sep 11, 2021
Merged

Conversation

pranaysashank
Copy link
Contributor

@pranaysashank pranaysashank commented Sep 7, 2021

This is a low effort fix for haskell/vscode-haskell#445 . The lsp spec says

/**
 * Defines an unsigned integer number in the range of 0 to 2^31 - 1.
 */
export type uinteger = number;

interface Position {
	line: uinteger;
	character: uinteger;
}

A proper fix would be to create a new type in lsp-types for uinteger.

Debug info

This check returns false https://github.com/microsoft/vscode-languageserver-node/blob/8ad6896d8910214b7a3c8fee8dd175077a743045/client/src/common/client.ts#L1940 and vscode tries to parse it as SymbolInformation instead of DocumentSymbol and you get the error reported in the above issue.

The check for uinteger is at https://github.com/microsoft/vscode-languageserver-node/blob/8ad6896d8910214b7a3c8fee8dd175077a743045/types/src/main.ts#L3756

@pranaysashank
Copy link
Contributor Author

Looks like this is a recent change to the spec, from 3.16. I couldn't find a corresponding changelog in the specification.

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Member

@jneira jneira left a comment

Choose a reason for hiding this comment

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

@pranaysashank many thanks for fix that disturbing bug

@jneira jneira added the merge me Label to trigger pull request merge label Sep 7, 2021
@pepeiborra pepeiborra merged commit 155023f into haskell:master Sep 11, 2021
michaelpj added a commit to michaelpj/lsp that referenced this pull request Nov 6, 2021
This ensures that we use either:
- `Int32`
- `Word32`
- `Float`

In particular, this gets us:
- Appropriate `Bounded` instances (see the original issue
haskell/haskell-language-server#2169).
- More picky `aeson` instances for the bounded types.

Rather than use newtypes, we just use the existing appropriate Haskell
numeric types for bounded integers.

Fixes haskell#354.
michaelpj added a commit to haskell/lsp that referenced this pull request Nov 7, 2021
This ensures that we use either:
- `Int32`
- `Word32`
- `Float`

In particular, this gets us:
- Appropriate `Bounded` instances (see the original issue
haskell/haskell-language-server#2169).
- More picky `aeson` instances for the bounded types.

Rather than use newtypes, we just use the existing appropriate Haskell
numeric types for bounded integers.

Fixes #354.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants