Skip to content
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

New IS engine is unable to recognize C99 for loop initial declaration #685

Closed
mikedld opened this issue May 3, 2017 · 7 comments
Closed
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service

Comments

@mikedld
Copy link

mikedld commented May 3, 2017

I'm using v0.11.0 with Default IS mode and Enabled error squiggles, and editing C file (with .c extension). This seems to work fine (pre-C99):

int i;
for (i = 0; i < 10; ++i) ...

Moving variable declaration into the for construct like this (C99):

for (int i = 0; i < 10; ++i) ...

leads to error squiggles saying "expected an expression" and "identifier "i" is undefined". Changing "int" in the above example to a typedef-ed type leads to a bit different set of errors: "type name is not allowed", "expected a ';'", and "identifier "i" is undefined".

This is confusing as some other C99 features like intermixing code and variable declarations are being processed just fine. And even more confusing as you advertise this new IS engine as being based on MSVC IS engine and VS 2015 has no trouble recognizing the above construct as well.

@sean-mcmanus sean-mcmanus added Language Service more info needed The issue report is not actionable in its current state labels May 3, 2017
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented May 3, 2017

I'm not able to repro the problem you describe (I don't get those error squiggles in a .c file). We have some bugs in regards to error squiggles not being updated correctly after a file is edited. Could you be hitting that? What OS are you on?

@mikedld
Copy link
Author

mikedld commented May 3, 2017

The issue is reproduced by creating new file named test.c and typing in the following content:

int main()
{
    for (int i = 0; i < 10; ++i) {}
}

Saving/editing issues definitely aren't involved here. I'm seeing this on both macOS (latest VSCode Insider 0.12.0, 0834f15...) and GNU/Linux (VSCode 1.11.2, 6eaebe3...).

@mikedld
Copy link
Author

mikedld commented May 3, 2017

To elaborate on that "definitely" part, I tried closing and re-opening the file, and restarting VSCode. All the same. I also had all the extensions except for ms-vscode.cpptools disabled.

@sean-mcmanus
Copy link
Contributor

Okay, thanks a lot for this report. It's a bug with our Linux/Mac implementation and doesn't repro on Windows.

@sean-mcmanus sean-mcmanus added bug and removed more info needed The issue report is not actionable in its current state labels May 3, 2017
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented May 4, 2017

We have a fix for our next update, but you can make the change yourself by opening ~/.vscode/extensions/ms-vscode.cpptools-0.11.0/bin/msvc.json file and replacing "--c" with "--c\n--c11" near the bottom of the file. Let us know if you encounter any issue with this.

@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label May 4, 2017
@mikedld
Copy link
Author

mikedld commented May 4, 2017

Thanks, the workaround worked a treat.

@bobbrow
Copy link
Member

bobbrow commented May 23, 2017

This was fixed in version 0.11.1. Please reopen if you continue to have this issue.

@bobbrow bobbrow closed this as completed May 23, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

3 participants