wkirschbaum / elixir-ts-mode

Elixir mode using Treesitter for fontification, navigation and indentation
GNU General Public License v3.0
61 stars 11 forks source link

Improvements for font locking #30

Closed scohen closed 11 months ago

scohen commented 1 year ago

I was getting elixir-ts-mode set up and noticed what I think are inconsistencies about how font locks are applied, and I'd like to help improve them, if that's what's requested.

I'm looking at what I think are Emacs's default font locks.

Consider the following snippet:

[key: :value]

The key: has font-lock-builtin-face applied, while :value has font-lock-type-face applied to it. They're both atoms, so I would expect for them to have the same face. I sort of understand why :value has the type face applied, since atoms are modules in erlang, though I would much rather have elixir modules look special and erlang modules look like atoms. It also seems to me that even if we limit ourselves to the default emacs faces, there's probably better faces to choose like font-lock-constant-face or font-lock-property-name-face.

In the following snippet;

  def test() do

the parens have font-lock-keyword-face despite not being keywords and font-lock-bracket-face existing in the emacs defaults.

Is this something that you'd be interested in working on with my help? I know next to nothing about treesitter or elisp.

scohen commented 1 year ago

To give you an idea of what the results are: This is elixir-mode Screenshot 2023-10-21 at 12 47 20 PM

and this is elixir-ts-mode Screenshot 2023-10-21 at 12 47 44 PM

wkirschbaum commented 11 months ago

Closing in favour of https://github.com/wkirschbaum/elixir-ts-mode/issues/35