-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement: support fragments when finding DSL options
fix: support latest elixir_ls changes unfortunately, we're going to have a failing CI until elixir-lsp/elixir_sense#296 is merged
- Loading branch information
1 parent
87634f9
commit 8c0c2e9
Showing
8 changed files
with
175 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
defmodule Spark.ElixirSense.BehaviourSetter do | ||
@moduledoc false | ||
# This module serves as a workaround for changes in ElixirLS behavior implementation. | ||
# It allows us to reference a non-existent behavior without triggering compile-time warnings. | ||
|
||
defmacro __before_compile__(_env) do | ||
quote do | ||
Module.put_attribute(__MODULE__, :behaviour, ElixirLS.LanguageServer.Plugin) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
defmodule Spark.IgniterTest do | ||
use ExUnit.Case | ||
|
||
import Igniter.Test | ||
|
||
test "options are found in DSLs" do | ||
assert {_igniter, {:ok, Bar.Baz}} = | ||
test_project() | ||
|> Igniter.Code.Module.create_module(TedDansen, """ | ||
use Spark.Test.Contact | ||
contact do | ||
module(Bar.Baz) | ||
end | ||
""") | ||
|> Spark.Igniter.get_option(TedDansen, [:contact, :module]) | ||
end | ||
|
||
test "options are found in fragments" do | ||
assert {_igniter, {:ok, "foobar"}} = | ||
test_project() | ||
|> Igniter.Code.Module.create_module(TedDansenFragment, """ | ||
@moduledoc false | ||
use Spark.Dsl.Fragment, of: Spark.Test.Contact | ||
address do | ||
street("foobar") | ||
end | ||
""") | ||
|> Igniter.Code.Module.create_module(TedDansen, """ | ||
use Spark.Test.Contact, fragments: [TedDansenFragment] | ||
contact do | ||
module(Bar.Baz) | ||
end | ||
""") | ||
|> Spark.Igniter.get_option(TedDansen, [:address, :street]) | ||
end | ||
end |