Skip to content

Wrong syntax highlight #418

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

Closed
NJichev opened this issue Apr 12, 2018 · 3 comments
Closed

Wrong syntax highlight #418

NJichev opened this issue Apr 12, 2018 · 3 comments

Comments

@NJichev
Copy link

NJichev commented Apr 12, 2018

Got following type not syntax highlighted as an atom:

@type t :: %TestSuite{test: (() -> any), status: :pending}

The test: key is different from status(from ExUnit I suppose)

@mhinz
Copy link
Contributor

mhinz commented Apr 19, 2018

Hmm, there is no difference for me.

Both, test: and status: are highlighted as elixirAtom, if I put that single line in an .ex file.

What does :echo synIDattr(synID(line("."), col("."), 1), "name") report if the cursor is over the key?

@NJichev
Copy link
Author

NJichev commented Apr 19, 2018

It says elixirExUnitMacro.

Here's the extracted piece of code:

defmodule TestSuite.Test do
  @typep f :: (() -> any)
  @typep status :: :pending | :failed | :skipped | :timed_out | :passed
  @typep tags :: [atom]

  @type t :: %Test{
    test: f,
    status: status,
    tags: tags,
  }
end

Could be a PEBKAC problem :D

@mhinz
Copy link
Contributor

mhinz commented Apr 19, 2018

Well, I can reproduce it with that code. I'll look into it.

mhinz added a commit that referenced this issue Apr 19, 2018
Assumption: ExUnit macros are always followed by space.

Technically, a macro's argument can be put into parentheses, but that happens
only seldomly. It's more likely that a function gets named after an ExUnit
macro.

Fixes #418
@NJichev NJichev closed this as completed Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants