-
Notifications
You must be signed in to change notification settings - Fork 24
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
endif without if in context.vim file #74
Comments
Thank you! Do you want to open a PR to remove it? |
You please go ahead and fix this as part of your next planned release. Thank you so much for your great work. I use targets too. May I know the reason why you wanted to skip the pre-processor directives in C code? IMO they add a lot of value to the context. |
Thanks, will do 👍
Sure. The context currently works based on indentation. Because the pre-processor directives often have zero indentation that means that the context will effectively have no more context lines above. A bit hard to explain, here's an example. Consider this code: https://gist.github.com/wellle/981686e250e6bc1851b78fbcc6dc6b3a#file-v-c-L126 Currently the context of the highlighted line is find_some_match(argvars, rettv, type) ··· {
if (regmatch.regprog != NULL) {
for (;;) {
if (l != NULL) { ··· }
else { If I update the skip regex to effectively allow the #ifdef FEAT_MBYTE It might be possible to come up with more complex logic to allow both pre-processor directives and retain the full context from above, but that would be a lot of extra work. For now I had just decided to exclude those lines, as in my example above the result seems more useful. Hope that makes sense. |
Got it. I updated the skip regex to allow the # and I see the same behavior as you mentioned. I wasnt aware that the context update is heavily relying upon the indentation. I was thinking more in terms of C code only not in a generic way. |
Fixed in #76. Thanks again! And regarding your last comment, yes you're right, the context itself could definitely be smarter if it were implemented in a language specific way. But so far I opted for a general purpose approach and I'm hoping that it's going to be good enough 🤞 |
In file autoload/context/context.vim, in s:limit function, there is an extra endif towards the end without if.
The text was updated successfully, but these errors were encountered: