-
-
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
Incorrect completion text when using DuplicateRecordFields #682
Comments
This patch to ghcide fixes things: diff --git a/src/Development/IDE/Plugin/Completions/Logic.hs b/src/Development/IDE/Plugin/Completions/Logic.hs
index f91a3f7..19f5a78 100644
--- a/src/Development/IDE/Plugin/Completions/Logic.hs
+++ b/src/Development/IDE/Plugin/Completions/Logic.hs
@@ -647,7 +647,7 @@ openingBacktick line prefixModule prefixText Position { _character }
-- don't want in the autocompleted symbols
stripAutoGenerated :: CompItem -> CompItem
stripAutoGenerated ci =
- ci {label = stripPrefix (label ci)}
+ ci {label = stripPrefix (label ci), insertText = stripPrefix (insertText ci)}
{- When e.g. DuplicateRecordFields is enabled, compiler generates
names like "$sel:accessor:One" and "$sel:accessor:Two" to disambiguate record selectors
https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/DuplicateRecordFields#Implementation This does sadly break the record completion snippet though. I'm not sure what caused this regression, but the recent change nearby is |
@expipiplus1 if #685 fixes it too, i hope it keeps record completion snippet ok |
@expipiplus1 It breaks the record completion snippet, since the completion snippets that are values in |
I think this fixes it. But, we need to make sure it does not break any other cases:
@expipiplus1 Do you plan on working on this fix? |
Checking this out now, surely it leaves things less broken than they are currently; and isn't that what tests are for :D
Not sure I can spare the cycles at this busy time of year I'm afraid, also there seems to be other work going on in similar places at the moment. |
Ok. Thanks. I can work on a quick fix on this issue. |
@expipiplus1 One other question on your initial comment:
I am curious why you did not find this useful. Each of the entries are qualified with respective record declarations as you see here. |
Ah, It's because I don't display that information and forgot that that might be the default, so I just see a bunch of repeated lines with the same purpose (to insert
Thanks! FWIW the patch you posted earlier is working very well. |
I think this issue is fixed and can be closed. |
Thanks! |
@gdevanla @expipiplus1 thanks for confirming it, closing! |
This problem still exists( |
Ugh, we have to revise this then, a regression test would be definitely needed |
Your environment
Output of
haskell-language-server --probe-tools
orhaskell-language-server-wrapper --probe-tools
:Which lsp-client do you use:
This happens with nvim/coc and vscode
Steps to reproduce
In
Foo.hs
:in
Bar.hs
:memb
member
is suggested twice (not useful)member
:member:Foo
is inserted instead ofmember
I suppose that this is some incorrect demangling of the
$sel:Foo:member
names that GHC uses.The text was updated successfully, but these errors were encountered: