jbenden / vscode-c-cpp-flylint

A VS Code extension for advanced, modern, static analysis of C/C++ that supports a number of back-end analyzer programs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow includePaths to change with Intellisense configuration

evanperrygrove-sibelinc opened this issue · comments

I have a few workspaces that contain 3 or 4 different projects. They share the overwhelming majority of their code, but each one has its own folder with a different "config.h" file.

My .code-workspace file has identical settings for C_Cpp.default.includePath and c-cpp-flylint.includePaths, and then I have multiple c_cpp_properties.json files, with configurations like this:

  "configurations": [
    {
      "name": "Project 1",
      "defines": [
        "${default}",
      ],
      "includePath": [
        "${default}",
        "${workspaceFolder}/../project1/config"
      ],
      "cppStandard": "c++11",
      "cStandard": "c11"
    },
    {
      "name": "Project 2",
      "defines": [
        "${default}",
        "SOME_EXTRA_MACRO"
      ],
      "includePath": [
        "${default}",
        "${workspaceFolder}/../project2/config"
      ],
      "cppStandard": "c++11",
      "cStandard": "c11"
    },
    "... (and so on. you get the idea)"
  ]

This allows me to switch between the projects in the workspace, and Intellisense updates its syntax highlighting and error checking appropriately. I would like to be able to do the same thing with c-cpp-flylint. Even better, if I could just tell c-cpp-flylint to use whatever includePaths and defines Intellisense is currently using, that would make life a lot easier.

Oh, so based on this code:

const platformConfig = cCppProperties.configurations.find(el => el.name === propertiesPlatform());
I see that now c-cpp-flylint only takes c_cpp_properties.json configuration that is named Mac, Linux, Win32, ignoring your "Project 1".

To make it flexible, c-cpp-flylint would somehow need to check ${command:cpptools.activeConfigName} variable, instead of propertiesPlatform(): microsoft/vscode-cpptools#3219 .

@dzid26 Hi! Would you be able to test the branch activeConfigName, to see if it meets all needs?

The most recent version of the extension now includes these changes!

Should any problems arise, please feel free to re-open this bug report!

Thanks!
-Joe