Hi! I'd like to know what would be the contribution process to improve the highlight of some specific language. I see that there's a Ruby demo here and it seems that it's a little more flavorful than what I get with Elixir.
For example:
Both Ruby & Elixir module names are "white", but Ruby classes have a "yellow" color.
I guess that for Elixir the mapping would be: Ruby classes -> Elixir Modules
In Ruby there are class variables and instance variables, in Elixir we only have module attributes.
But everything in Elixir that starts with "@" is colored "green"
Ruby methods are colored "blue", but elixir functions are colored "green". Piggybacking on the last item, since we usually use module attributes next to functions, it gets too "greenish" in that zone.
This is an example comparing both:
And here's a code snippet (don't try to compile that), that tries to demonstrate some of the language aspects:
defmodule ExampleModule do
@moduledoc """
Module documentation
"""
require Another.Module
import Another.Module
alias Another.Module
@type type() :: __MODULE__
@module_attribute 1
defstruct [:field1, :field2, field3: "Optional", field4: 42, field5: []]
def function_examples do
function_with_args(:arg)
function_no_args
end
def list_access do
list = [1, 2] ++ [3]
list
|> Enum.uniq()
|> Enum.at(1)
end
@deprecated "This function is deprecated"
@spec deprecated_function(term()) :: term()
def deprecated_function_with_spec(param), do: nil
def map_access do
atom_map = %{
key1: "info",
key2: "info"
}
string_map = %{
"key1" => "info",
"key2" => "info"
}
atom_map.key1
atom_map[:key1]
string_map["key2"]
end
@doc """
This function is very well documented
"""
def output do
IO.puts "Output here"
IO.inspect(nil, label: "Output here")
end
def pattern_matching_function(%__MODULE__{field1: field1}) when not is_nil(field1) do
"I am function with pattern matching and guards!"
end
def pattern_matching_function(%__MODULE__{field1: field1}) do
"I am function with pattern matching!"
end
defmacro metaprogramming_macro(param) do
quote do
IO.inspect("Hello from #{__MODULE__}, #{unquote(param)})"
end
end
defp other_function(opts \\ []) do
IO.puts "doing other stuff #{0..42}"
end
defp another_private_function() do
[1, 2, 3] |> Enum.each(fn item -> IO.puts(item) end)
end
defp calling_erlang_modules(), do: :millisecond |> :os.system_time() |> to_string()
end
BTW: Would it be possible to publish the current color palette somewhere? This way I could test locally and suggest changes based that on what it's working for me. Also, I can't find any information about the current guideline the theme uses to color language constructs - if there's one, this would be really helpful.
Hi! I'd like to know what would be the contribution process to improve the highlight of some specific language. I see that there's a Ruby demo here and it seems that it's a little more flavorful than what I get with Elixir.
For example:
Both Ruby & Elixir module names are "white", but Ruby classes have a "yellow" color. I guess that for Elixir the mapping would be: Ruby classes -> Elixir Modules
In Ruby there are class variables and instance variables, in Elixir we only have module attributes. But everything in Elixir that starts with "@" is colored "green"
Ruby methods are colored "blue", but elixir functions are colored "green". Piggybacking on the last item, since we usually use module attributes next to functions, it gets too "greenish" in that zone.
This is an example comparing both:
And here's a code snippet (don't try to compile that), that tries to demonstrate some of the language aspects:
BTW: Would it be possible to publish the current color palette somewhere? This way I could test locally and suggest changes based that on what it's working for me. Also, I can't find any information about the current guideline the theme uses to color language constructs - if there's one, this would be really helpful.