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

How do I set the default configuration? #1599

Closed
wolf99 opened this issue Feb 23, 2018 · 5 comments
Closed

How do I set the default configuration? #1599

wolf99 opened this issue Feb 23, 2018 · 5 comments
Assignees
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@wolf99
Copy link

wolf99 commented Feb 23, 2018

I have MSYS2 on my Windows PC and have added configuration to c_cpp_properties,json to allow IntelliSense to know about it. However, whenever I start VS Code the selected configuration is always set back to Win32. Is there some way I can tell cpp tools that this folder uses a different configuration? (MinGW64 in this case) while still keeping Win32 available to be selected?

This is my additions to the c_cpp_properties.json configurations:

        {
            "name": "Win32",
            "includePath": [
                "${workspaceRoot}"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "intelliSenseMode": "msvc-x64",
            "browse": {
                "path": [
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        },
        {
            "name": "MinGW64",
            "intelliSenseMode": "clang-x64",
            "includePath": [
                "${workspaceRoot}",
                "C:/msys64/mingw64/include/c++/7.3.0",
                "C:/msys64/mingw64/include/c++/7.3.0/x86_64-w64-mingw32",
                "C:/msys64/mingw64/include/c++/7.3.0/backward",
                "C:/msys64/mingw64/include",
                "C:/msys64/mingw64/x86_64-w64-mingw32/include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "__GNUC__=6",
                "__cdecl=__attribute__((__cdecl__))"
            ],
            "browse": {
                "path": [
                    "C:/msys64/mingw64/include",
                    "C:/msys64/mingw64/x86_64-w64-mingw32/include",
                    "C:/msys64/mingw64/x86_64-w64-mingw32/include/*"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
@bobbrow
Copy link
Member

bobbrow commented Feb 23, 2018

That sounds like a bug. We don't have a way to set a "default" configuration right now, but we should be saving the active configuration when you close VSCode so that you can start where you left off the next time you open the folder. Do you use a multi-root workspace?

@wolf99
Copy link
Author

wolf99 commented Feb 25, 2018

Hi @bobbrow, no, I am seeing this with a single-root workspace. I can do some more experimenting with the nature of this tomorrow now I know there is supposed to be active config recall.

@wolf99
Copy link
Author

wolf99 commented Feb 26, 2018

I've thrown together a very basic C++ program in a new directory, with the following c_cpp_properties.json. If I select the MinGW64 configuration, the green squiggles in the includes go away. If I then close and immediately reopen vscode it shows Win32 as the selected configuration, the green squiggles are back and I get a prompt to configure includePath for better IntelliSense results.

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "/usr/include",
                "/usr/local/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/local/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ]
        },
        {
            "name": "Linux",
            "includePath": [
                "/usr/include",
                "/usr/local/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/local/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        },
        {
            "name": "Win32",
            "includePath": [
                "${workspaceRoot}"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "intelliSenseMode": "msvc-x64",
            "browse": {
                "path": [
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        },
        {
            "name": "MinGW64",
            "intelliSenseMode": "clang-x64",
            "includePath": [
                "${workspaceRoot}",
                "C:/msys64/mingw64/include/c++/7.3.0",
                "C:/msys64/mingw64/include/c++/7.3.0/x86_64-w64-mingw32",
                "C:/msys64/mingw64/include/c++/7.3.0/backward",
                "C:/msys64/mingw64/include",
                "C:/msys64/mingw64/x86_64-w64-mingw32/include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "__GNUC__=6",
                "__cdecl=__attribute__((__cdecl__))"
            ],
            "browse": {
                "path": [
                    "C:/msys64/mingw64/include",
                    "C:/msys64/mingw64/x86_64-w64-mingw32/include",
                    "C:/msys64/mingw64/x86_64-w64-mingw32/include/*"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 3
}

@sean-mcmanus
Copy link
Collaborator

Thanks for reporting this -- we're able to repro the bug. It's resetting to the OS default if there are 3 or more configs. You can work around this by deleting one of the unused configs.

@bobbrow bobbrow added this to the April 2018 milestone Apr 9, 2018
@bobbrow bobbrow self-assigned this Apr 9, 2018
bobbrow added a commit that referenced this issue Apr 9, 2018
bobbrow added a commit that referenced this issue Apr 10, 2018
* addresses #1599, #1790

* Update all configs when c_cpp_properties.json is parsed
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Apr 17, 2018
@bobbrow
Copy link
Member

bobbrow commented May 8, 2018

This is fixed in 0.17.0.

@bobbrow bobbrow closed this as completed May 8, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 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