You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
inline if statement has an 'end' statement linked to it and highlighted making the end statements after it incorrect #656
I am not very familiar with vscode api, but is it possible to get textmate scope name from there? Recently I created PR where each language structure which closes with end keyword has different scope name. with it you can distinguish if modifier from if code block and optional do (like in while true do) from real do bloock #666
In short, this is not the only bug with this feature. It will break if you have a keyword in string, regular expression or even in comment section. And ofcourse it will break not only wtih if modifier, but also with unlesswhile and until modifiers.
Furthermore there are some ambigious cases with modifiers. For example "hello".match /(he)/ if condition and 10 / if rand(0..10) >= 5 then 5 else 2 end
In both cases if goes after / but it is modifier only when it goes after regex. Same thing with %r<re> literal
I am sure its possible to check for all this stuff with just a sequential matching with regexes but it will be quite hard. Strings, regexes and other structures could be multiline and you need to keep track of it while scanning in order to find a correct pair.
Everything I mentioned before has already been solved in #666 . Unfortunately there is no API (microsoft/vscode#580) to get textmate scopes from extensions. So what I did is just parsed file again with new grammar file within this extension and it works fine. I think i fixed all bugs with this feature and now it can correctly highlight start and end of code blocks even in tricky oneliners like this:
I've just encountered this error a couple days ago. I know it's probably a bit anal-retentive on me, but this kind of issue makes me want to not use VS Code for Ruby development altogether. Are there any plans to fix this?
Activity
matt-stanley commentedon Sep 29, 2020
Consider this workaround: use a semicolon (;) to end lines containing inline if statements. That will cause the block highlighting regex to ignore.
I can't figure out a way to exclude inline if in the regex, but am willing to brainstorm if you have any ideas.
graceful-potato commentedon Oct 11, 2020
@matt-stanley could you please show a code that is responsible for this?
matt-stanley commentedon Oct 14, 2020
Sorry for the late reply. Highlighting and pairing:
https://github.com/rubyide/vscode-ruby/blob/master/packages/vscode-ruby-client/src/providers/highlight.ts
graceful-potato commentedon Oct 14, 2020
I am not very familiar with vscode api, but is it possible to get textmate scope name from there? Recently I created PR where each language structure which closes with
endkeyword has different scope name. with it you can distinguishifmodifier fromifcode block and optionaldo(like inwhile true do) from realdobloock#666
graceful-potato commentedon Oct 25, 2020
In short, this is not the only bug with this feature. It will break if you have a keyword in string, regular expression or even in comment section. And ofcourse it will break not only wtih
ifmodifier, but also withunlesswhileanduntilmodifiers.Furthermore there are some ambigious cases with modifiers. For example
"hello".match /(he)/ if conditionand10 / if rand(0..10) >= 5 then 5 else 2 endIn both cases
ifgoes after/but it is modifier only when it goes after regex. Same thing with%r<re>literalI am sure its possible to check for all this stuff with just a sequential matching with regexes but it will be quite hard. Strings, regexes and other structures could be multiline and you need to keep track of it while scanning in order to find a correct pair.
Everything I mentioned before has already been solved in #666 . Unfortunately there is no API (microsoft/vscode#580) to get textmate scopes from extensions. So what I did is just parsed file again with new grammar file within this extension and it works fine. I think i fixed all bugs with this feature and now it can correctly highlight start and end of code blocks even in tricky oneliners like this:
#670 if anyone wants to test
github-actions commentedon Nov 25, 2020
This issue has not had activity for 30 days. It will be automatically closed in 7 days.
art-solopov commentedon Sep 25, 2021
I've just encountered this error a couple days ago. I know it's probably a bit anal-retentive on me, but this kind of issue makes me want to not use VS Code for Ruby development altogether. Are there any plans to fix this?