serkonda7 / vscode-vba

VBA language extension to use with VS Code. Also used for syntax highlighting on GitHub.
https://marketplace.visualstudio.com/items?itemName=serkonda7.vscode-vba
Mozilla Public License 2.0
34 stars 12 forks source link

Fix lookbehinds (for Linguist compatibility) #80

Closed DecimalTurn closed 1 year ago

DecimalTurn commented 1 year ago

See https://github.com/serkonda7/vscode-vba/issues/76#issuecomment-1575351421

Note that this PR shouldn't change any behaviors of grammar highlighting which is why no additionnal tests were provided.

serkonda7 commented 1 year ago

I think the problem is, that the non-capture group (previous lookbehind) is already matched by another pattern. Backreferences could work: https://rbuckton.github.io/regexp-features/engines/oniguruma.html#feature-backreferences

serkonda7 commented 1 year ago

I have pushed a commit that keeps the lookbehind but with a fixed length. Please check if this would work.

DecimalTurn commented 1 year ago

I think the problem is, that the non-capture group (previous lookbehind) is already matched by another pattern.

There seems to be some interactions that I don't fully understand indeed. We can stick with your solution instead.

I have pushed a commit that keeps the lookbehind but with a fixed length. Please check if this would work.

I just ran some tests in local and the script add-grammar works. This seems good to go. Let me know when the changes are pushed to https://github.com/tiabeast/vscode-vba-json and I'll finish the PR for Linguist.

serkonda7 commented 1 year ago

The https://github.com/tiabeast/vscode-vba-json repo is updated automatically via CI after pushes to main. So in a few minutes it should be ready.