Skip to content

Add handling of MSVC /external:var option and EXTERNAL_INCLUDE env variable. #14205

Closed

Description

It look like /external:var and EXTERNAL_INCLUDE are not handled. These should influence IntelliSense configurations by potentially adding include paths. (Identifying include path not previously specified, as external, will implicitly specify them as include paths.)

Some behavior clarification is here, in the context of aligning clang-cl behavior with MSVC: llvm/llvm-project#105738

Related: #14186

Activity

  1. Subham-KRLX commented on Feb 23, 2026

    @Subham-KRLX
    Contributor

    Colen Garoutte-Carson (@Colengms) i would like to fix this issue can you please assign this to me.

  2. Subham-KRLX commented on Feb 23, 2026

    @Subham-KRLX
    Contributor

    I have submitted PR #14208 to address this. It implements robust parsing for the specialized MSVC/clang-cl flags and automatically resolves the EXTERNAL_INCLUDE environment variable ensuring these paths are correctly injected into the IntelliSense configuration.

  3. Colengms commented on Feb 23, 2026

    @Colengms
    ContributorAuthor

    Hi Subham (@Subham-KRLX) . This is something we need to implement in our native component, where we currently support /external:I and the INCLUDE env variable, in common code shared with other projects. I don't think we can take a fix for this in the OpenSource TypeScript component.

  4. Subham-KRLX commented on Feb 24, 2026

    @Subham-KRLX
    Contributor

    Colen Garoutte-Carson (@Colengms) I understand that this needs to be handled in the native component alongside the existing /external:I and INCLUDE support. I will close my PR. Appreciate the context.

  5. huangqinjin commented on Feb 28, 2026

    @huangqinjin

    Colen Garoutte-Carson (@Colengms) EXTERNAL_INCLUDE should influence IntelliSense, but looks like it is not possible to set EXTERNAL_INCLUDE by configurationProvider.

    As vscode-cmake-tools can setup custom environment variables by environmentSetupScript, I am trying to provide EXTERNAL_INCLUDE to IntelliSense through compilerArgs with /external:I in microsoft/vscode-cmake-tools#4718.

    Can we handle /external:I as system includes or provide a way to set EXTERNAL_INCLUDE by configurationProvider?

  6. moved this from In progress to Pull Request in cpptoolson Sep 10, 2026
  7. moved this from Pull Request to Done in cpptoolson Sep 15, 2026
  8. added
    fixedCheck the Milestone for the release in which the fix is or will be available.
    on Sep 19, 2026
  9. Colengms commented on Nov 4, 2026

    @Colengms
    ContributorAuthor

    Can we handle /external:I as system includes

    Hi huangqinjin . That would not be correct behavior. There are some common misconceptions around how they are intended to be handled. (i.e. llvm/llvm-project#181294 ) At the compiler level, /external:I and EXTERNAL_INCLUDE are intended for diagnostic filtering only. While there is a scenario in which they may add non-system include paths (as a side effect of failing to find an existing non-system include path to consider a system include path solely for the purpose of diagnostics), they do not modify the compiler (or IntelliSense) include paths to specify system search order.

    With MSVC, /external:I can add an include path (if /external:W# is also specified) to be considered "external" for the purpose of external header diagnostics only. It does not specify that the include path should be a "system" include path (like gcc and clang's -isystem arg). I don't believe MSVC provides an argument that would allow the caller to add a system include path.

    Unfortunately, at this time, there does not appear to be any option to cause cl.exe to consider an additional include path as a system include path. clang-cl does exhibit this behavior, but only due to a bug ( llvm/llvm-project#181294 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions