Alhadis / language-apl

APL language support for Atom.
https://atom.io/packages/language-apl
ISC License
7 stars 3 forks source link

Better TextMate scopes for various language elements #8

Closed jayfoad closed 6 years ago

jayfoad commented 6 years ago

language-apl seems to use the "wrong" TextMate scope for various APL language elements.

I apologise in advance that this issue is a mixture of things that just seem wrong to me, and things that actually affect github syntax colouring.

Diving right in:

Alhadis commented 6 years ago

System names like ⎕FOO are support.system.variable.apl; should perhaps be support.variable.system.apl

The order in which scope-names appear is immaterial, meaning the two scope-lists above are effectively equivalent.

should be entity.name.label.apl / entity.name.function.apl because entity.name is a well-known documented scope

As above, the appearance of name in the scope-list chain wouldn't make a difference. ;)

but I find it a bit unfortunate that they get coloured the same as "real" APL keywords like :If. What scope do other language grammars tend to use for symbolic operators?

This, actually. They tend to use keyword.operator.arithmetic for things like + / * - and keyword.operator.logical.boolean for things like != or &&, etc. However, the keyword.operator scopes aren't strictly limited to symbolic forms - it's common to see true scoped as keyword.operator.boolean.logical.true, for example.

I think what complicates this issue most is that APL has a well-refined notion of what an "operator" is, whereas TextMate grammars have a less defined and broader interpretation. I recall this was a source of confusion for me early in the project as I deliberated between TextMate/APL semantics and naming conventions.

What do you think we should do?

jayfoad commented 6 years ago

The order in which scope-names appear is immaterial

Thanks. I didn't know that.

What do you think we should do?

I've looked at a few other languages. Java and Javascript use keyword.operator for their operators. C and Go leave them uncategorised.

My personal preference would be not to categorise APL primitives as any kind of keyword, just because I don't like seeing so much red on github.com, but I certainly won't try to insist. Is there anyone else who might have a reasonable view on this, or on the use of keyword.operator in general?

Maybe I should petition github-syntax-theme-generator to colour keyword.operators differently from all other keywords...?

Alhadis commented 6 years ago

Heh. Well even if you do now, there's no telling if they'll be worsened by sudden future changes when GitHub's designers settle on a modified colour scheme.

In other words, what looks great now mightn't look as great after a redesign impacts syntax highlighting...

jayfoad commented 6 years ago

OK. Well, since plenty of other language grammars are using keyword.operator for their operators, and it's documented as the correct thing to do, I hereby withdraw my complaint.

Thanks for the other fix!