-
Notifications
You must be signed in to change notification settings - Fork 30
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
Highlighting error when defining global variables with construction functions #282
Comments
So to summarize this issue:
|
@jeff-hykin When there is an ambiguity between a function definition and a constructor call should the highlighting of |
@jeff-hykin It should be possible to first try matching a single line to look for a valid function definition and fall back on the pattern-range only if the definition spread across more than one line? That should make it possible to detect that |
You probably already know this stuff @matter123 , I'm going to summarize it for myself and others though. Multi-line caseFundamentally, this issue is that there's no pattern for function initializations.
Textmate can only look at one line before irreversibly jumping into a range. Right now when it sees All one line cases
Special cases of one liners
The makeshift solution (then old and probably future answer)Rather than knowing if it actually is a function call or an initialization, its possible to pretend that it is always both, and then highlight things accordingly. The reason this isn't working right now is because, in order to make the parameters be highlighted better, some assumptions were made that are perfectly valid for function definitions. However, those assumptions are screwing up inside of initializations. I'm going to try to make a partial fix to make this problem not cascade beyond the initialization parentheses. I'll close this issue once that is fixed. However, I'll create another issue for the more general problem, including deciding how to tag the ambiguous |
Fixed an pushed with |
The problem still exists in mt19937 gen(time(nullptr) ^ (size_t) new char);
// mt19937 gen(1234);
// mt19937 gen(time(nullptr));
inline int randint(int l, int r)
{
return uniform_int_distribution<>(l, r)(gen);
}
int main()
{
for (int i = 1; i <= N; ++i)
R[i] = randint(0, 100) & 31;
return 0;
} |
The main issue has been fixed in v1.12.15. There is an issue with the highlighting of size_t, Ill file a separate issue. |
@Dust1404 let me know if you find any more cases. I'm pretty confident this most recent change will have covered all of them. |
VSCode 1.35.1
Better C++ Syntax 1.12.11
similar to #206
The text was updated successfully, but these errors were encountered: