-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Upgrade to new version of lsp libraries #2494
Conversation
I'll squash all these and tidy up before merging, once this works. |
I would release LSP and changing this to use it before merge, as final sanity check over the released version (the bump of hackage index could change the behaviour) |
wow
|
Obviusly that exceeds the max bound for Word32/Int32: 2147483647 |
Exciting. |
It is due to quickcheck using arbitrary instances for a numeric type bigger than Word32: haskell-language-server/ghcide/test/exe/Main.hs Lines 6314 to 6344 in bb73e32
|
I think i have a fix |
Why do you want runtime errors from dynamic types if you can have them with pesky type classes? :-P |
Hang on, I'm fixing a bunch of these. |
I did a different fix, oops 😅 |
Releasing the lock for a bit now! Honestly, the |
I also wonder about having an |
well i checked manually the inputs for nthLine to ensure they were always in (0, maxBound :: Word32) and not sure what would be the sensible option, i guess we will want round for some and error for others 🤷 |
It's not |
Ugh so ghc can return negative values as i vaguely remebered 🤦 |
In some ways this is good though: I believe technically a lsp client could simply have refused to parse a message where the position had a negative value, now we're forced to deal with it earlier. |
Tests seem to pass... windows builds hanging (?) as usual. |
the stack build is failing due to unused imports:
|
We fail on unused imports in some builds but not others? oy vey. |
ya inconsistent, I would make cabal ones stricter |
@@ -79,7 +79,7 @@ realSrcSpanToRange real = | |||
|
|||
realSrcLocToPosition :: RealSrcLoc -> Position | |||
realSrcLocToPosition real = | |||
Position (srcLocLine real - 1) (srcLocCol real - 1) | |||
Position (fromIntegral $ srcLocLine real - 1) (fromIntegral $ srcLocCol real - 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will currently wrap. Should we do something else here? Like take max 0
first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah not sure if we have another sensible alternative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. I think either let it wrap or max with 0.
-- In the lsp spec from 3.16 Position takes a uinteger, | ||
-- where uinteger is 0 - 2^31 - 1. lsp-types currently has the type of line | ||
-- as Int. So instead of using `maxBound :: Int` we hardcode the maxBound of | ||
-- uinteger. 2 ^ 31 - 1 == 2147483647 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh. I think this means I got it wrong: uinteger
according to the LSP specification is not, in fact a 32-bit unsigned integer, but a 31-bit unsigned integer. Presumably because it's actually a 32-bit signed integer that they just restrict to be positive. Terrible. I don't even know what to do about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made them an issue: microsoft/language-server-protocol#1394
But in the short term this kind of sucks...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I can go back and use a custom type instead of Word32
in lsp
, sigh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, but we can go ahead with this lsp version? or you want to redefine the type in lso before the release
I guess we can continue using the hardcoded maxBound?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice not to release a version of lsp
that disruptively requires people to change their code and then doesn't even fix the problem :(
I think the best thing might be to change to a custom type in lsp
indeed. It shouldn't affect this PR too much. Either that or we should just revert the change in lsp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm but if we use UInt31 in LSP with all the required intances, including from integral, would no be matter of replacing Word32 with UInt31 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's basically it. I just need to do it. I'll try and find time tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe with a more generic name like LSPUInt? not sure if the data type could even change in the spec but I can imagine it could be bigger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9901326
to
b26c499
Compare
So this needs the change to use the new UInt31 from lsp |
Yes, and I was going to try and remove the |
haskell/lsp#384 awaits for review. |
I have the stack.yamls changed to use a recent commit and they works here #2551 |
This is not only for faster completions. It's also needed to have semi-fresh completions after editing. This is specially important for the first completion request of a file - without this change there are no completions available at all
useful to synchonize on these events in tests
25a59a8
to
1d94ed5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm many thanks for working on this
9.0.1 is not picking the new index state
🤔 |
Yeah, it seems like it's not calling |
ugh we removed it cause the Haskell action seemed to do it, but maybe not in all cases |
hmm, is it related with the lsp changes? maybe with the drop of dependent-sum?
|
@jneira try |
Yes. I pretty much was wondering when Action particularly runs Also after all this only today noted that Action does not use the latest We also had the typo that borked (which is seen in) the In any case, if there is now some kind of error - it probably may be the rm of |
after merging master CI succeeded, not sure why (have to take a deeper look) |
* Update to latest version of lsp libraries * Compute completions on kick This is not only for faster completions. It's also needed to have semi-fresh completions after editing. This is specially important for the first completion request of a file - without this change there are no completions available at all * Emit LSP custom messages on kick start/finish useful to synchonize on these events in tests * Fix completions tests after haskell/lsp#376 * Restore cabal update with comments * Use new lsp in stack 9.0.1 Co-authored-by: Pepe Iborra <[email protected]> Co-authored-by: jneira <[email protected]> fix merge failure
Don't look here (except @jneira), just for CI.
This branch has the new version pulled in by
source-repository-package.
We could merge it that way, or we could wait until we do alsp
release, which is desirable anyway.