-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid variable length lookbehind #220
Avoid variable length lookbehind #220
Conversation
cc @Gerrit0, this should fix VSCode issue. |
db92540
to
df577c2
Compare
This doesn't seem to do the right thing: I'm not sure about Linguist, but TextMate regexes are not permitted to match across lines (microsoft/vscode-textmate#32), which makes properly handling the last two cases essentially impossible. Am I missing some reason that we need lookbehind here at all? The following (with
|
df577c2
to
5426265
Compare
Updated. seems to work on linguist side as well. Thanks! |
Shoot, I figured out why the lookbehind was there... public class A {
public void Nullish() {
char s = ss ?? 'x'
if (true) {} // if is wrong color
}
} This feels like something else is out of order though. Why is the grammar even getting to conditional expressions if null coalescing matches? This is my first foray into this bit of work, so I'm probably not understanding something else... |
That case is handled otherwise csharp-tmLanguage/test/expressions.tests.ts Line 3028 in 11731b4
|
public class A {
public void Nullish() {
- char s = ss ?? 'x'
+ char s = ss ?? 'x';
if (true) {} // if is wrong color
}
} |
Oh! That makes sense, thanks!... too much time in TypeScript where I never have to type them and they will get automatically added on save. |
Regarding github/linguist repo, since now it supports (more superior) tree-sitter grammar (github-linguist/linguist#5483 (comment)), we maybe able to switch to https://github.com/tree-sitter/tree-sitter-c-sharp. The code navigation feature in GitHub has already started to use it: https://docs.github.com/en/github/managing-files-in-a-repository/managing-files-on-github/navigating-code-on-github. |
@am11 Thanks! |
so the solution to keep both worlds happy is to use most common syntax; fixed length lookbehind.