atom-language-julia icon indicating copy to clipboard operation
atom-language-julia copied to clipboard

Syntax highlight `Int[]` etc.

Open karajan9 opened this issue 5 years ago • 0 comments

It would be nice to highlight the types in array creation statements like Int[] the same way they are highlighted with Vector{Int}(). As @pfitzseb mentioned on Slack, simply highlighting everything before [] runs into problems with a[] after a = Ref{Int}(), to which he suggested to highlight only TitleCase.

Pros:

  • extra highlighting makes the code easier to read
  • consistency with highlighting types elsewhere

Cons:

  • it will give a false negative for people who don't use TitleCase for their own types
  • it will give a false positive for people who use TitleCase for their variables and use Ref

Since the Julia manual suggests "modules and type names use capitalization and camel case: module SparseArrays, struct UnitRange." and the next logical step would to use everything but this for variables, one could argue that the cons shouldn't affect too many people.

karajan9 avatar Sep 12 '19 07:09 karajan9