Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Fix import suggestions when dot is typed #800

Merged
merged 3 commits into from
Sep 17, 2020
Merged

Conversation

lazamar
Copy link
Contributor

@lazamar lazamar commented Sep 13, 2020

Fixes #613 and #342 at haskell-language-server.

Before

Before

After

Untitled

@lazamar
Copy link
Contributor Author

lazamar commented Sep 13, 2020

I tried adding a completion test, but for some reason module suggestions are not being captured. It is not clear to me why.
The test added is here lazamar@4aefe73 and fails with

test/exe/Main.hs:2466:
expected: [("Control.Applicative",Just CiModule)]
but got: []

Copy link
Collaborator

@pepeiborra pepeiborra 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 sir!

While this fixes the bug in ghcide, I suspect the bug is upstream. What to do? I'm happy to merge this now and roll it back later if the fix is replicated in haskell-lsp. Equally happy to wait for the fix to land in haskell-lsp. Your choice

src/Development/IDE/Plugin/Completions.hs Show resolved Hide resolved
src/Development/IDE/Plugin/Completions/Logic.hs Outdated Show resolved Hide resolved
Copy link
Collaborator

@pepeiborra pepeiborra left a comment

Choose a reason for hiding this comment

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

Can we get a test, so that this will not break silently again?

@wz1000
Copy link
Collaborator

wz1000 commented Sep 16, 2020

@lazamar are you planning to add tests in this PR? I need this commit for a merge of my hls-3 branch, so if you aren't keen on doing this soon, I can try to include some tests in the upcoming and merge this as is.

@lazamar
Copy link
Contributor Author

lazamar commented Sep 16, 2020

@wz1000 I wrote a brief test here lazamar@4aefe73 but couldn't get completions to show up.
I can only look at it tomorrow night. If you decide to merge it as is I can make another PR for the test.

@wz1000
Copy link
Collaborator

wz1000 commented Sep 17, 2020

I believe the issue with that test is that the Position is 0-indexed, so you need to subtract 1 from the coordinates.

@wz1000
Copy link
Collaborator

wz1000 commented Sep 17, 2020

Also, we need a stale parsed module to generate completions, so the module has to compile initially, and then the partial import line has to be added in.

@wz1000 wz1000 merged commit 4184f7d into haskell:master Sep 17, 2020
pepeiborra pushed a commit to pepeiborra/ghcide that referenced this pull request Oct 5, 2020
* Fix module suggestions

* Document PositionMapping

* Remove maybe
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
* Fix module suggestions

* Document PositionMapping

* Remove maybe
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
* Fix module suggestions

* Document PositionMapping

* Remove maybe
pepeiborra pushed a commit to pepeiborra/ide that referenced this pull request Dec 29, 2020
* Fix module suggestions

* Document PositionMapping

* Remove maybe
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Completing 3-component module names doesn't work
4 participants