halohalospecial / atom-elmjutsu

A bag of tricks for developing with Elm. (Atom package)
https://atom.io/packages/elmjutsu
MIT License
193 stars 24 forks source link

Auto-complete selection bug #3

Closed OvermindDL1 closed 7 years ago

OvermindDL1 commented 8 years ago

Greetings, first see this image https://overminddl1.com/screenshots/work/elmjutsu-report0.gif: bug demo

  1. I type out Navigation.pro, this is perfect (and fast!), although page up/down does not work (instead the page jumps up/down)
  2. The first 'argument' is already selected, which selects not only the first argument but also the record opening { and the entire first argument to the record of init (of which the end part of ( model, Platform.Cmd.Cmd msg ) got oddly changed to remove the first parenthesis to become model, Platform.Cmd.Cmd msg ), and view and subscriptions somehow got its -> vanished.
  3. I type 1 to replace it, to signify it is arg 1, then hit
  4. It then selects the next part of the record, the update, I replace it with 2 and hit
  5. So on and so forth.

The type of Navigation.programWithFlags as per the sidekick is:

Navigation.programWithFlags : Navigation.Parser data -> { init : flags -> data -> ( model, Platform.Cmd.Cmd msg ) , update : msg -> model -> ( model, Platform.Cmd.Cmd msg ) , urlUpdate : data -> model -> ( model, Platform.Cmd.Cmd msg ) , view : model -> Html.Html msg , subscriptions : model -> Platform.Sub.Sub msg } -> Platform.Program flags

And yet the auto-complete selection of programWithFlags is:

Navigation.programWithFlags (Navigation.Parser data -> { init : flags -> data ->  model, Platform.Cmd.Cmd msg ) ( , update : msg -> model ->  model, Platform.Cmd.Cmd msg ) ( , urlUpdate : data -> model ->  model, Platform.Cmd.Cmd msg ) , view : model Html.Html msg , subscriptions : model Platform.Sub.Sub msg }

Which does not seem to match at all. There are many spurious parenthesis (out of order with { and such too), when what should probably happen is it output this (with the things inside of brackets < > being tabbable and everything else skipped:

Navigation.programWithFlags < Navigation.Parser data >
  { init = < flags -> data -> ( model, Platform.Cmd.Cmd msg ) >
  , update = < msg -> model -> ( model, Platform.Cmd.Cmd msg ) >
  , urlUpdate = < data -> model -> ( model, Platform.Cmd.Cmd msg ) >
  , view = < model -> Html.Html msg >
  , subscriptions = < model -> Platform.Sub.Sub msg >
  }

Appropriately indented of course. Or perhaps this should be the auto-completed result (notice only two arguments within < >, one is the parser and the other is the record):

Navigation.programWithFlags < Navigation.Parser data > < { init = flags -> data -> ( model, Platform.Cmd.Cmd msg ) , update = msg -> model -> ( model, Platform.Cmd.Cmd msg ) , urlUpdate = data -> model -> ( model, Platform.Cmd.Cmd msg ) , view = model -> Html.Html msg , subscriptions = model -> Platform.Sub.Sub msg }>

Regardless, the current method results in very broken tabbing. :-)

halohalospecial commented 7 years ago

Fixed in v2.10.4 :)