rzk-lang / vscode-rzk

Visual Studio Code Extension(s) for Rzk proof assistant.
https://marketplace.visualstudio.com/items?itemName=NikolaiKudasovfizruk.rzk-1-experimental-highlighting
Other
7 stars 1 forks source link

Syntax highlighting when "uses" is on another line #62

Open fizruk opened 9 months ago

fizruk commented 9 months ago

Syntax highlighting currently assumes that uses (...) is on the same line as #define. The highlighting should be more flexible.

aabounegm commented 9 months ago

This seems to be a limitation of TextMate grammar. According to https://github.com/microsoft/vscode-textmate/issues/41#issuecomment-344294298, RegEx in TextMate will not match across multiple lines, meaning that all \ss in the grammar will also suffer from this problem (and indeed I see the same issue when adding a new line between #define and the definition name). This is further verified in this RegEx playground, where it successfully captured all groups of the Regular Expression. Edit: this is also mentioned in section 12.2 of the TextMate docs

I believe it should be possible to fix it using begin and end captures, but that would probably be complicated and we might be better off adding it to the semantic highlighter.