raulchedrese/nova-elixir-ls

Syntax highlighting - defprotocl coloring is not correct

Closed this issue · 1 comments

Syntax tokenising for defprotocol seems incorrect.

CleanShot 2020-12-07 at 16 41 38@2x

I have drawn in the screenshot where the function scopes are defined. In Nova, I have activated the folding bar and set that pairs of brackets and tags should be highlighted. So as soon as I mark the first re-colored 'end' (line 76) Nova shows which tag belongs to it (Wrong - line 71).

I'm not sure if this is an issue solely for the Nova extension or the ElixirLS project. But for sure the tokens are not correct.
image

defmodule CSV do
    defprotocol Specification do
        @spec version(t) :: String.t()
        def version(value)
    end
    
    defimpl Specification, for: BitString do
        def version(value), do: value
    end

    defimpl Specification, for: Integer do
        def version(value), do: inspect(value)
    end
end

GitHub correctly colors the source code ;-)

Hey @denny-trebbin, fixing this issue ended up being quite the rabbit hole 😅. I ended up deciding to rework the entire syntax definition to fix some other bugs and also to get a better understanding of how the definition files work. The new version is on the syntax-rework branch.

I'm hoping to merge it soon but there are a few things I need to add first.