Tidal icon indicating copy to clipboard operation
Tidal copied to clipboard

Autocomplete for Emacs mode tidal.el

Open xmacex opened this issue 5 years ago • 2 comments

Is your feature request related to a problem? Please describe. Autocomplete in Emacs would be nice, to save typing and reduce typos.

Describe the function/feature you'd like When typing things, the editor would suggest defined symbols which match partial user input. Like you know an autocomplete.

Describe alternatives you've considered Emacs has (AFAIK) two autocomplete engines, Auto-Complete and Company. The latter, Company allows creation of backends quite nicely.

SCENE 1.

ENTER THE SKEPTIC

  • The Skeptic: "I am not entirely sure if Tidal should actually have it's own, special autocomplete or should a generic Haskell autocomplete be used."
  • The Protagonist: "It is ye, the vile Skeptic, bringer of doubts! What unfortunate turn of events lured ye here? Since there are two kinds of things to complete, Haskell functions and sounds in SuperCollider, I thought maybe an algoraving -specific completion mechanism makes sense."

Tidal defaults to using GHCi as the Haskell environment. GHCi has this nice :complete repl "9" command for completing to 90s_was_an_era_of_excellent_rave_music, 909, 99luftballons etc. Company can also provide a bit of metadata for the Emacs to present to the user for a richer completing experience than just a list of symbols with a given prefix.

Additional context

SCENE 2.

emacs-tidal-autocomplete-in-the-works

I am lowkey (very lowkey) working on this here https://github.com/xmacex/Tidal/tree/autocomplete-for-emacs on a Company backend, and will make a PR to Tidal when it is somehow ready for showtime.

Currently (2020-05-12) it does successfully retrieve minimal completions of Haskell symbols, but there are all kinds of issues such as a bug caused by asynchronous execution, no nice metadata, SuperCollider/SuperDirt sounds are not completed, there are no tests or useful documentation, no error resilience e.g. in the case of non-GHCi Haskell environment etc. My Haskell skills are non-existent and I don't even understand how the whole contraption works, and my ELisp skills are trash, but I'm learning :)

xmacex avatar May 12 '20 10:05 xmacex

In atom-tidalcycles :browse Sound.Tidal.Context is used to retrieve tidal function names and build autocomplete data. In addition, hoogle is used to add documentaion.

ndr-brt avatar May 12 '20 13:05 ndr-brt

Thanks @ndr-brt!

xmacex avatar May 17 '20 19:05 xmacex