-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Completing 3-component module names doesn't work #892
Comments
I also note that there are no tests of module completions, but lots of others for different types of completion. |
Hello I took a quick look at this and these were my findings. It seems that the issue occurs when code completion is requested upon Subsequently a stale mapping is read from Shake and the cursor position is moved back one character. Using the completion of This
When I would expect the correct value to be:
The position is mapped back from From debugging a bit further I could see that Shake is reading the I also noticed that when a completion trigger character is pressed the completion request is received immediately (perhaps causing a race condition):
So at this point the issue seems to be reading a stale mapping, but i'm not sure if the solution is:
This is my first time looking at GHCIDE (and Shake) so I'm still a bit unsure about the relationship between Shake and the language server. Any guidance would be much appreciated! 1
|
Thanks for the diagnosis! I've not done much work in this area, but if any other maintainer has, it would be great to get some feedback. My guess from your explanation is that the Shake bits and stale info aren't relevant. We got the correct full line from PosPrefixInfo. My guess is that PosPrefixInfo is misparsing the full line, and you are right about what it should be in this circumstance, and then we'd be correct. If so, that's a bug with the upstream haskell-lsp, and probably one missing case in a string splitting routine. But I'm totally guessing. |
The issue is not upstream in haskell-lsp, but in the cursor position provided to Continuing with the previous example, the position argument ( Here is the flow I have observed:
|
Is it possible we're confusing 0-based and 1-based indicies at some point leading to an off by one error? (I'll admit, I'm quite out of my depth here) |
I think this also affects modules with more segments, such as |
If you type in
import Control.Concurrent.C
then the suggested completion isConcurrent.Chan
. If you select that completion you end up withimport Control.Concurrent.Concurrent.Chan
, which is definitely not what you expected. I run into this all the time since theExtra
modules are typically 3 components long.The text was updated successfully, but these errors were encountered: