ash-project / spark

Tooling for building DSLs in Elixir
MIT License
127 stars 25 forks source link

Add `Spark.Builtins` #33

Closed zachdaniel closed 6 months ago

zachdaniel commented 1 year ago

One of the spark types we have is {:spark_function_behaviour, ... that allows specifying a "builtins module" which is a module from which to show autocompletions automatically. What we should do is allow other modules to add to that list by putting doing the following:

defmodule Foo do
  use Spark.Builtins, for: Ash.Resource.Changes.Builtins, extension: ExtensionName
end

for example.

The spark autocomplete extension would then look for any module doing that and add its functions into the mix, as long as the resource is using the provided extension. (since the extension would do the importing). Then users would get nice autocomplete of automatically imported additional builtins.

zachdaniel commented 6 months ago

I'm going to close this as unplanned, as it's a bit too implicit/indirect. importing functions is easy and works well.