bmalehorn / vscode-fish

Fish syntax highlighting and formatting
MIT License
65 stars 7 forks source link

Function description highlight error #10

Closed Bit0r closed 4 years ago

Bit0r commented 4 years ago

--description is highlighted as a string, not a parameter image

bmalehorn commented 4 years ago

Technically, the fish extension highlights does recognize --description as different than plains strings. The extension labels options as string.other.option.fish. But the default VSCode Dark+ theme does not have a special case for string.other.option.fish and highlights it as just a string.

https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#scope-inspector

image

So it's not highlighted correctly because the default VSCode theme does not have a color for command-line option.

I could work around this by instead inaccurately labeling the string as string.regexp. This would get a distinct color, but might mislead users into thinking it was a regexp:

image

A third option is to do no special highlighting:

image

@Bit0r What do you think would make the most sense?

Bit0r commented 4 years ago

Is there any difference between the second picture and the third picture, is the wrong picture uploaded? But I think it can be highlighted as a label or macro?

Bit0r commented 4 years ago

Latest fish also supports logical operators such as && || !, hope to add highlighting support :) There are also two special symbols & |, which can be highlighted as bit operators (although they are not bit operations, they can be done)

bmalehorn commented 4 years ago

Is there any difference between the second picture and the third picture, is the wrong picture uploaded? Ah yup, I uploaded the wrong picture. I've now uploaded the correct picture.

Latest fish also supports logical operators such as && || !, hope to add highlighting support :) There are also two special symbols & |, which can be highlighted as bit operators (although they are not bit operations, they can be done)

Ah, fish does correctly label &&, ||, !, & and |! But the default Dark+ theme highlights them as plain white text. It does the same thing in JavaScript code - && is highlighted as plain white text. However some themes do highlight it:

Dark+ (default dark) Monokai
image image
image image

So it's not a problem of vscode-fish not labeling the text correctly, but rather that the Dark+ theme does not highlight every scope with a different color. I'd recommend trying out different themes to see if you can find one that highlights what you want.

But I think it can be highlighted as a label or macro?

It looks like labels aren't highlighted any differently, but macros are:

image

Still, I'm kind of leaning towards removing the syntax highlighting entirely on --option flags. They don't mean anything special in fish, --option is no different than option, it just has a conventional meeting. So the most accurate thing might be to not highlight it at all. Thoughts?

Bit0r commented 4 years ago

I think this is a good idea