vscode-elixir
vscode-elixir copied to clipboard
[WIP] #21: highlight code blocks
Beginning working on highlighting code blocks.
This will close #21
There are some 'edge' cases that currently are unsupported:
def call(%Plug.Conn{} = conn, []),
do: conn # <- do: on next line after def
def clear_session(conn) do
put_session(conn, fn(_existing) -> Map.new end) # end on same line as fn ->
end
def code(integer_or_atom) # function declaration w/o body
def call(conn, level) do
Logger.log level, fn ->
[conn.method, ?\s, conn.request_path]
end
start = current_time()
Conn.register_before_send(conn, fn conn ->
Logger.log level, fn ->
stop = current_time()
diff = time_diff(start, stop)
[connection_type(conn), ?\s, Integer.to_string(conn.status),
" in ", formatted_diff(diff)]
end
conn
end) # <- 'end' with trailing ')'
end
In my simple phoenix application it does work pretty well at the moment. But I think before releasing this, those edge cases should be handled.
@fr1zle Hi, are you still interested in this feature? I could solve these edge cases for you.
Sure, feel free to pickup from here or open up a new PR
I digged into it and I conclude that to do it well I need an elixir parser or at least a lexer. Unfortunately number of constructs like many kind of strings, comments, sigils, atoms which I should exclude to find proper keyword is to big. Do you know if I can get a parse tree/ast with position annotations from Elixir Sense?