-
Notifications
You must be signed in to change notification settings - Fork 21
Presentation compiler autocompletion bug with dependent types #10353
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
Comments
I just tested this with ScalaIDE and Ensime, both show the same behaviour as the REPL. |
I built your branch and can confirm that it's fixed for the repl (when starting Here's what I did:
|
@mpollmeier I've pushed an alternative fix to scala/scala#5927. Could you see if that improves the situation with Ensime, too? |
@retronym @mpollmeier there is also https://github.com/ensime/pcplod to set up an easy test for any piece of code in the presentation compiler. Somewhat related, I've dreamt of writing a I'm waiting for @yangwen0228 to confirm if https://github.com/ensime/ensime-emacs/issues/624 is a real presentation compiler bug or not (could be in our emacs code) and if so it would be super useful if you could help us to write it up in the |
@fommil I actually started with pcplod for my analysis, but it doesn't (yet) allow to verify the autocomplete suggestions from the PC, right? I think I can add this to pcplod though if that makes sense. |
ok that's be cool! Usually infer type is enough but that'd be a nice addition. |
(double post) Btw as you suggested I tested the combination of give the combination of scala/scala#5929 and scala/scala#5927 |
Original discussion here: https://contributors.scala-lang.org/t/presentation-compiler-autocompletion-bug-with-dependent-types/897
This a bit of an edge case, I guess that's why it wasn't discovered yet: Autocompletion fails when using dependent types AND omitting the (empty) first parameter block. You can reproduce it in the repl as follows:
Then type
Test1.withParens().<TAB>
- it does find autocompletions for String. However, if you tryTest1.withoutParens.<TAB>
it does not. As a workaround, when saving intermediate result, it works:val a = Test1.withoutParens; a.<TAB>
Without dependent types, autocompletion works fine in both cases:
The best solution would be to fix this in the presentation compiler, but I didn't manage to pin down the problem there. Instead, as a workaround, I patched the repl autocompletion - if it doesn't find any autocompletions, it interprets the code up until that point and then tries again. Here's a mini repo that's using the presentation compiler and the patched autocompletion:
https://github.com/mpollmeier/scala-presentation-compiler-autocomplete-fix-
If you use
PresentationCompilerCompleter
instead ofMyPresentationCompilerCompleter
in the test, you get the old behaviour (no autocompletion).From @retronym:
The text was updated successfully, but these errors were encountered: