atom-supercollider icon indicating copy to clipboard operation
atom-supercollider copied to clipboard

[WIP] autocomplete-plus support

Open ssfrr opened this issue 8 years ago • 1 comments
trafficstars

This is a first cut at autocomplete support. It assumes you're using supercolliderjs with my recent socket PR.

Here it pulls the list of class names and documentation summaries right after booting the server, and queries for class methods on-the-fly.

I agree with your comment elsewhere that loading the class info from a file would be nice so we can still auto-complete if SCLang is crashing or otherwise unavailable. The balance is basically making sure that the autocompletion is up-to-date whenever possible, so if the user adds a Quark or custom class it should show up after their next reboot. In general a reasonable fallback plan seems like:

  1. Use fresh data (from the last SCLang boot) whenever possible
  2. If SCLang didn't boot successfully, use a cached copy from the last boot
  3. If there are no cached copies, load from a default file that ships with the package with all the classes that ship with SC.

I'll test out whether getting all the class methods is fast enough to do it up-front rather then at autocomplete-time.

Still more to do (this is somewhat aspirational, we'll see how far I get):

  • [ ] handle inherited methods
  • [ ] merge Class.prop and Class.prop_ methods with some readable/writable indication
  • [ ] figure out cacheing for when SCLang is unavailable
  • [ ] better feedback when you're in the middle of an argument list (maybe snippet support?)
  • [ ] add variable support - if we can statically figure out the class of a variable it would be great to be able to autocomplete instance members/methods
  • [ ] incorporate the regular text-based autocomplete so we also complete identifiers in the file.

I'll add a demo gif shortly. :)

ssfrr avatar Sep 29 '17 06:09 ssfrr

I started this before those other PRs were merged, so I'll need to rebase.

Here's a gif:

atom supercollider autocomplete demo

ssfrr avatar Sep 29 '17 06:09 ssfrr