tidalcycles / vscode-tidalcycles

Support for TidalCycles in VSCode
GNU General Public License v3.0
35 stars 11 forks source link

Hover info and command completion for Tidal commands #14

Closed oscons closed 5 years ago

oscons commented 5 years ago

Hey there. Since I'm bad at remembering command and what parameters they take, I've modified the vscode extension to read command descriptions from a Yaml file and use that info to provide hover and command completion support for Tidal commands.

The matching to the commands is purely done on a string basis at the moment, ignoring only commented out areas. This is the most pragmatic way but might lead to some false-positives, e.g. it'll match tidal identifiers also in strings.

One, IMHO, nice feature for beginners is that every command description can also hold some examples, which can be executed right away from the message window, by clicking on run next to the example. This sends the command internally the existing tidal.eval command, which I enabled to take additional parameters.

As of this commit/pull request the command definitions are ... sparse :) If you're interested in merging this to your master, I'll add some more commands. Maybe there's even a way to generate the info from the Tidal doc itself.

Additional things that might be worth doing, and which I've held off until I get some feedback, are:

Let me know what you think. Cheers, oscons

oscons commented 5 years ago

With cbdc8a2 I've added a generated list of command descriptions based on the lists in the Wiki. Even though not all commands do have a description there, at least they'll show up in code completion.

The way it's implemented at the moment any manually defined description in commands.yaml takes precedence over the generated ones, so if there's a "nicer" description for the command, that will be used.

kindohm commented 5 years ago

Thanks @oscons! I will pull this down and give it a try when I get a chance.

kindohm commented 5 years ago

This is really cool! Thanks for working on it!

oscons commented 5 years ago

No worries. Thanks for merging! I'll open another request for the missing features (especially being able to configure hover/completion functionality on and off, which might be less annoying for live-events).