meraymond2 / idris-vscode

Idris front-end for VS Code
MIT License
58 stars 10 forks source link

Syntax highlighting sometimes fails #46

Closed Z-snails closed 3 years ago

Z-snails commented 3 years ago

In some files syntax highlighting fails, even in a well defined file

For example

sendRequest : LinearIO io =>
       (1 _ : Socket Open) ->
       (msg : Request) ->
       L io {use=1} (Res Bool (\res => Socket (case res of
                                                    False => Closed
                                                    True => Open)))
sendRequest soc req = send soc (buildRequest req)

fails to highlight properly after the case expression.

Edit: I believe this may be a problem with brackets in types where the start and end are on different lines, as when I replace the brackets with $s it highlights correctly.

meraymond2 commented 3 years ago

I'm not 100% sure what you mean by 'fails to highlight properly after the case expression.', but I think I see it. The function_signature rule is matching a bit too much, and is overriding other more meaningful scopes. I think I can reduce it a bit, I'm pretty sure the only meaningful scope it adds is to the function-name itself.

Just to confirm, is this what you had in mind? Monokai: Before: image After: image

One Dark: Before: image After: image

Z-snails commented 3 years ago

Yeah, that's what I meant. I mentioned the case expression to make it clear where the problem was (also initially I thought the case might have been the problem before I realised it was most likely the brackets).

Thanks for fixing it so quickly.

meraymond2 commented 3 years ago

Just pushed a new version, with that change.