go2sh / cmake-integration-vscode

CMake Server Interface for VSCode.
https://go2sh.github.io/cmake-integration-vscode/
Other
19 stars 11 forks source link

Add Intellisense support for header and unknown files #7

Closed go2sh closed 5 years ago

atar-axis commented 5 years ago

When hitting F12 the message no definition found appears - is that what this issue is about?

image cmake_integration_test.zip

go2sh commented 5 years ago

This is a issue with the cpptools. I see the same. Try to open and close foo/bar.h and hit F12 again. The funny thing is. The types from the file get used correctly. So if you hit F12 on a class or function from that file, it should be shown immediately.

This issue is about getting the intellisense configuration for the header file it self. I'll release it in a moment.

go2sh commented 5 years ago

Just released it. :-)

atar-axis commented 5 years ago

This is a issue with the cpptools.

Funny thing is: It does work when I disable CMake-Integration (and reset the database + reload).

atar-axis commented 5 years ago

cmake_integration_not_found_issue

go2sh commented 5 years ago

can show me the content of the c_cpp_properties.json file?

atar-axis commented 5 years ago

For sure, see the .zip here: https://github.com/go2sh/cmake-integration-vscode/issues/7#issuecomment-461649633

(Or wait a Bit until i get to my pc)

atar-axis commented 5 years ago
{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/src"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/g++",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64",
            "configurationProvider": "go2sh.cmake-integration"
        }
    ],
    "version": 4
}
go2sh commented 5 years ago

The thing is, your c_cpp_properties.json has src as include folder, where as your CMake project does not. This is the reason for your difference. I think it is some how a bug, that cpptools extension by default doesn't respect relative includes. :-/

atar-axis commented 5 years ago

Ha, you are right - after adding

target_include_directories(${PROJECT_NAME}
    PRIVATE
        src
)

everything works as expected. Thanks once again!