vscode-flix icon indicating copy to clipboard operation
vscode-flix copied to clipboard

Arrow color when no space

Open magnus-madsen opened this issue 1 year ago • 7 comments

We use -> without space around it for struct field access:

image

@sockmaster27 Do you think it would be possible to give it a different color? I tried messing around in the grammar file, but I was unsuccessful.

magnus-madsen avatar Aug 26 '24 18:08 magnus-madsen

I can fix it in the normal VS Code color scheme, but it's sort of a problem that the Flixify theme makes all keywords and operators the same color, so the only way to get it to be different is either to not categorize it as anything, or to categorize it as like a string literal or something.

I don't know if such semantic abuse could hurt anything (I'm specifically thinking of Linguist that does more than just highlighting), but it at the very least feels wrong, and it might be a problem with other third party themes.

Could we change the Flixify theme to accommodate this?

sockmaster27 avatar Aug 30 '24 19:08 sockmaster27

I suppose I never thought about whether -> is a keyword or an operator.

What if I want it to be neither?

magnus-madsen avatar Aug 30 '24 19:08 magnus-madsen

I suppose I never thought about whether -> is a keyword or an operator.

What if I want it to be neither?

It just needs to be in a category that the different color themes recognize, and it looks like the standard way to categorize an operator is called keyword.operator for whatever reason. I don't believe there's any reason for it to match the philosophy of the language one to one, but it's probably not great to suddenly categorize the arrow as a number literal or something like that.

I've found that categorizing the function arrow as a regular keyword and the struct arrow as an operator happens to work fairly well with most of the default themes, just not Flixify: image image image

sockmaster27 avatar Aug 30 '24 19:08 sockmaster27

Thanks for all the info. Very helpful. Ill talk to @dghosef and see what he thinks.

magnus-madsen avatar Aug 30 '24 19:08 magnus-madsen

What is . classified as(if anything)?

dghosef avatar Sep 02 '24 08:09 dghosef

What is . classified as(if anything)?

It's not categorized as anything currently.

sockmaster27 avatar Sep 02 '24 09:09 sockmaster27

It sort of feels that ->, #, and . have similar enough purposes that they should be highlighted in the same fashion. I'm not familiar with a lot of LSP stuff though or conventions with other languages

dghosef avatar Sep 02 '24 09:09 dghosef