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
Highlight fixes #241
base: main
Are you sure you want to change the base?
Highlight fixes #241
Conversation
[ | ||
(variant_identifier) | ||
(polyvar_identifier) | ||
] @constant | ||
] @constructor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not everyone might agree on this one, since variants, specially polyvars without parameters, are used as "constants". This thinking is common when making JS bindings, since polyvars compile to strings.
However, from a language perspective, I find it more correct to think of them as constructors. This is also how the ocaml parser highlights them.
|
||
; single parameter with no parens | ||
(function parameter: (value_identifier) @parameter) | ||
(function parameter: (value_identifier) @variable.parameter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and other similar changes conform to to Neovim's new tags with fallbacks. Meaning, if a certain theme specifies a color for @variable.parameter
, it will be used, but otherwise it will fall back to the color for @variable
.
b7c2103
to
10be739
Compare
It's what's in the neovim docs right now
This is how it's in the ecma parser (JS)
ccdbd1b
to
b5bbe2f
Compare
b5bbe2f
to
8461c77
Compare
(module_identifier) @namespace | ||
(module_identifier) @module | ||
|
||
(member_expression (property_identifier) @variable.member) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was @property
and was changed to @variable.member
. I looked at other languages and this is how it's usually handled: @property
is for places such as record definition when both the property and value are explicitly written, and member is for extracting a value out of that property. (which is why it belongs to the variable
group.)
Great job, leaving some comments and questions I had when testing highlighting in the The parameter Js.Array2.slice(~start=0, ~end_=Js.Array2.length(moduleRoute) - 1)
let version = (evt->ReactEvent.Form.target)["value"]
let rehypePlugins =
[Rehype.WithOptions([Plugin(Rehype.slug), SlugOption({prefix: slugPrefix ++ "-"})])]->Some
// ^ slug is highlighted as variable.member
let pathModule = Path.join([dir, version, `${moduleName}.json`])
let {Api.LocMsg.row: row, column, shortMsg} = locMsg
// ^ not highligted |
My reasoning on using However, I can see how it's not an exact fit. In OCaml they use What do you think? It's hard to debate what label fits better objectively, and it's hard to analyze which one looks better across themes. Honestly I think either
Yeah, that should be
My thinking is that it's the
Yeah that's wrong.
I like how OCaml handles it. Applied to this example, it would be: let {Api.LocMsg.row: row, column, shortMsg} = locMsg
// ^@variable.member
// ^@variable
// ^ @variable.member
// ^ @variable.member So regarding the row part, I definitely think it's the right highlight. For column and shortMsg I also like it, but we could also make them |
This PR contains some updates to existing highlights to conform to neovim's latest documentation, and also introduces a few missing ones.
The new features are: