Vscode-cpptools: Intellisense: Add ignore list for files or individual errors.

Created on 10 Nov 2017  路  5Comments  路  Source: microsoft/vscode-cpptools

In my project there are auto generated headers that is generated in compile time and deleted after. Intellisense do not find header and shows error. Also there are some files that is list of enum values that is inserted in other enum and Intellisense shows error.

Suggestion:
Add ignor list to ignore file, errors in file, or something like that.

Feature Request Language Service

Most helpful comment

This feature request has received enough votes to be added to our backlog.

All 5 comments

If we ignore the file, you will still end up with squiggles in your code because the symbols provided by that header won't be defined, right? I don't think this is something we will get to in the near term.

Yeah, it sounds like you want to change your build system to not delete the generated headers that are used to compile. You can set "C_Cpp.errorSquiggles" to false, but it's not per-file.

+1 It's annoying to have a cluttered Problems pane and significantly inflated count of errors shown in the status bar, which makes it harder for me to tell at a glance how many errors I've actually introduced when developing code changes.

My use case involves a particular generated include file:
You'll notice here that this ordinary header file has an enum definition in which it includes another file named "Attributes.inc", which is automatically generated during the build process for this project. I've added the directory containing the resulting generated file to my includePath, so after building everything, Intellisense successfully finds the generated include file. Interestingly, the header does seem to be parsed successfully by Intellisense, in so far as I do get autocomplete suggestions for values of the Attribute enum when working on code elsewhere, and I get squiggles if I mistype an enum value defined in the generated include file. However, if I try to peek or jump to the definition of an enum value, vscode opens the generated include file (which is great!) and then generates many spurious errors like "this declaration has no storage class or type specifier". This is probably because the generated include file is meant to be included inside of a enum definition, so it cannot be parsed as valid ordinary C/C++ header on its own. I'd really appreciate some way to tell Intellisense to suppress/hide the many warnings from this one file so they do not clutter the Problems pane and avoid contributing to the count of errors in the status bar, but I don't want to remove the generated header from my includePath, as Intellisense is doing a good job using it for autocomplete suggestions and informative squiggle/errors in other files using Attribute enums.

EDIT: For now a workaround is just closing VSCode entirely and relaunching it (w/o opening the problematic include file) which clears away the unwanted errors. This suggests an alternative feature that could help here: it would be nice if it were possible to clear away errors reported for a file that was previously opened and closed that I no longer care about, without having to restart VSCode.

@bobbrow wrote:

If we ignore the file, you will still end up with squiggles in your code because the symbols provided by that header won't be defined, right?

In my use case described in the previous comment, I've got an automatically generated include file that Intellisense seems to successfully parse when included by another file (which is really great!), but the problem is if I open the generated include file on its own I get a lot of spurious warnings which I'd like to suppress. It's not "include errors" that I want to suppress, but other errors within a generated file. Sorry if my ignore-some-errors feature request is in the wrong place, I wasn't sure whether to comment in #2345 or here.

This feature request has received enough votes to be added to our backlog.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arl picture arl  路  3Comments

narutse picture narutse  路  3Comments

ecbrodie picture ecbrodie  路  3Comments

montery8 picture montery8  路  3Comments

ismadelgad11 picture ismadelgad11  路  3Comments