You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
defmoduleExampleModuledo@moduledoc""" Module documentation """requireAnother.ModuleimportAnother.ModulealiasAnother.Module@typetype()::__MODULE__@module_attribute1defstruct[:field1,:field2,field3: "Optional",field4: 42,field5: []]deffunction_examplesdofunction_with_args(:arg)function_no_argsenddeflist_accessdolist=[1,2]++[3]list|>Enum.uniq()|>Enum.at(1)end@deprecated"This function is deprecated"@specdeprecated_function(term())::term()defdeprecated_function_with_spec(param),do: nildefmap_accessdoatom_map=%{key1: "info",key2: "info"}string_map=%{"key1"=>"info","key2"=>"info"}atom_map.key1atom_map[:key1]string_map["key2"]end@doc""" This function is very well documented """defoutputdoIO.puts"Output here"IO.inspect(nil,label: "Output here")enddefpattern_matching_function(%__MODULE__{field1: field1})whennotis_nil(field1)do"I am function with pattern matching and guards!"enddefpattern_matching_function(%__MODULE__{field1: field1})do"I am function with pattern matching!"enddefmacrometaprogramming_macro(param)doquotedoIO.inspect("Hello from #{__MODULE__}, #{unquote(param)})"endenddefpother_function(opts\\[])doIO.puts"doing other stuff #{0..42}"enddefpanother_private_function()do[1,2,3]|>Enum.each(fnitem->IO.puts(item)end)enddefpcalling_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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: