Why and how does `lc` get highlighted in `.ex` files?

Yesterday a coworker asked why VSCode highlights lc in .ex files. I was surprised to learn that it did. This is what you see if you turn on the scope inspector:

Another coworker suggested that lc stood for “list comprehension” and it was the precursor to for in the pre-1.0 Elixir days.

This seems like a good theory, but what bothered me was that I could not figure out where elixir-ls defines this keyword (I was hoping to look at a git blame). I’m not even sure if elixir-ls is responsible for this definition.

Can anyone confirm what lc was/is? And where it’s defined such that it gets highlighted?

1 Like

I do not know where it is defined in the syntax highlighting, but lc indeed was a keyword for list comprehensions before for. Here’s some very old code of mine:

    lc { entity, value } inlist decode_table do
        def decode(<< unquote(entity), rest :: binary >>), do: unquote(value) <> decode rest

vscode-elixir-ls 0.15 fixed this. Some old pre elixir 1.0 keywords was removed from the syntax


Thanks, @lukaszsamson! For my own clarity, here’s the (your) actual commit:

1 Like