-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
While working on the automatic protocol generators, it became clear that type aliases needed to be their own thing, as they operate quite differently from the other defined things in the jsonrpc protocol. Since they're just aliases, it makes sense to keep their definitions on hand and then spit them out when other things make use of them during encode and decode. This did require going back to encoding and ensuring all the encode functions return OK tuples.
- Loading branch information
Showing
9 changed files
with
178 additions
and
17 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
22 changes: 22 additions & 0 deletions
22
apps/language_server/lib/language_server/experimental/protocol/proto/alias.ex
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,22 @@ | ||
defmodule ElixirLS.LanguageServer.Experimental.Protocol.Proto.Alias do | ||
alias ElixirLS.LanguageServer.Experimental.Protocol.Proto.CompileMetadata | ||
|
||
defmacro defalias(alias_definition) do | ||
caller_module = __CALLER__.module | ||
CompileMetadata.add_type_alias_module(caller_module) | ||
|
||
quote location: :keep do | ||
def definition do | ||
unquote(alias_definition) | ||
end | ||
|
||
def __meta__(:type) do | ||
:type_alias | ||
end | ||
|
||
def __meta__(:param_names) do | ||
[] | ||
end | ||
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