crystal-lang-tools / vscode-crystal-lang

Yet another VSCode extension for Crystal Programming Language
https://marketplace.visualstudio.com/items?itemName=crystal-lang-tools.crystal-lang
MIT License
275 stars 57 forks source link

Color change when adding return type to class method #157

Closed jwoertink closed 5 months ago

jwoertink commented 1 year ago

Notice in this screenshot, the methods being called in the run instance method are currently white, and the class self.run method has no return type

image

Then when I add a return type to the class self.run method, all of the calls in the instance run method turn blue

image

nobodywasishere commented 1 year ago

I wasn't able to replicate this for some reason. What theme are you using in VSCode?

Screenshot_2023-07-21_00-05-45 Screenshot_2023-07-21_00-05-58

jwoertink commented 1 year ago

I've switched themes, and I'm still getting this. Here's some more info:

image

The theme I'm using now is "Bearded Theme Black and Emerald".

The specific file in the screenshots is actually from Lucky

https://github.com/luckyframework/lucky_cli/blob/main/src/generators/web.cr

another interesting issue here is that if I create a different class method, this doesn't happen... seems to be just that one?

image image

Very strange :joy:

nobodywasishere commented 1 year ago

Ah thank you! I figured it out. The end condition for methods with arguments didn't account for return parameters, and so it was capturing everything afterwards. https://github.com/crystal-lang-tools/vscode-crystal-lang/blob/c990acde25a020e910ca1092991e62289ceaa6c9/syntaxes/crystal.json#L291C6-L291C6. With a small change this should be fixed in the next release!

Screenshot_2023-07-22_17-54-56 Screenshot_2023-07-22_17-54-15

jwoertink commented 1 year ago

Woo hoo! Good find :+1:

jwoertink commented 7 months ago

This looks to be fixed in the v0.9.0-alpha release.