Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elixir highlighting is incorrect #1824

Closed
TMSCH opened this issue Sep 5, 2018 · 2 comments
Closed

Elixir highlighting is incorrect #1824

TMSCH opened this issue Sep 5, 2018 · 2 comments

Comments

@TMSCH
Copy link

TMSCH commented Sep 5, 2018

Hi Highlight team,

Here is an example showcasing the issues of Elixir highlighting. It's taken from reviewable.io UI that uses highlight.js under the hood.

First, highlight.js

screen shot 2018-09-05 at 10 20 31 am

Second, my VSCode editor
screen shot 2018-09-05 at 10 25 59 am
(there's some custom coloring going on here but I'll focus on the general issues)

What's wrong in highlight.js

  • Incorrect namespace highlighting in defmoduledeclaration (different colors when it should be monochrome)
  • Incorrect namespace highlighting in code body (monochrome when namespace should be different color)
  • require and import statements are not highlighted.
  • @moduledoc, @doc, @typedoc incorrectly highlighted as module attributes.
  • <- and |> not highlighted.
  • with statement not highlighted.

Thanks for looking into this!

@pkaminski
Copy link
Contributor

I'm working on a PR — here are my thoughts so far:

  • require, import and with are simply missing; added.
  • Module names can be compound (perhaps other names too?); allow . as part of identifier.
  • @moduledoc, @doc and @typedoc appear to be defined as module attributes, not sure why it's wrong to highlight them as such?
  • As far as I can tell by looking at the CSS class reference and other languages, highlight.js philosophy is not to highlight operators or namespaces. If that's not correct perhaps a maintainer can correct me?
  • Found an extra bug where :: and neighbors gets highlighted as symbol; fixed.

If we can clarify my questions above I can open a PR with the fixes. Thanks!

@TMSCH
Copy link
Author

TMSCH commented Sep 18, 2018

  • OK
  • OK
  • You're right, it's OK to keep them highlighted as module attributes.
  • Fine not to highlight namespace, as Objective C support #2 is fixed.
  • Great :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants