Ammonite icon indicating copy to clipboard operation
Ammonite copied to clipboard

Autocomplete import $ivy requires opening and closing back tick

Open stephennancekivell opened this issue 5 years ago • 2 comments

When using the new auto complete for $ivy imports feature https://github.com/lihaoyi/Ammonite/pull/957. The usability is a bit counter intuitive and not consistent with the other tab completion features. You must add two back ticks for the auto complete to trigger, when clicking tab, or it doesnt do anything. As I have tried to demonstrate in this gif.

import$ivy

PS. Thanks for this awesome feature.

stephennancekivell avatar May 20 '19 12:05 stephennancekivell

I confirm that the second closing backtick is necessary for now (for the initial code to be more or less correctly parsed, so that we can detect what the code corresponds to when trying to complete things).

I wish we could somehow close any open thing (", (, …) before completing

alexarchambault avatar May 20 '19 13:05 alexarchambault

This is definitely solvable using ScalaParse, the same way we currently do syntax highlighting: use the intercept parameter to capture parts of the parse tree, and use ~/ cuts in order to make sure we stop at the end of the file when there's an incomplete parse. This allows you to extract pieces of information out of an incomplete/broken parse tree, which should be enough to capture the partial import $ivy body and use it for autocomplete

lihaoyi avatar May 25 '19 05:05 lihaoyi