microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

Intellisense doesn't work at all #12893

Closed babaoglu53 closed 2 weeks ago

babaoglu53 commented 2 weeks ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary: Intellisense hasn't been working for about a week even though I haven't made any changes. includePath and cannot open source file error. In standard C++ libraries it doesn't give errors, but this time it doesn't find references. When I add my own libraries, it doesn't work at all.

What I tried:

Everything was normal until a week ago, but suddenly it stopped working.

Image Image

Configuration and Logs

{ "configurations": [ { "name": "Linux", "includePath": [ "${workspaceFolder}/**" ], "defines": [], "compilerPath": "/usr/local/bin/g++", "cStandard": "c11", "cppStandard": "c++14", "intelliSenseMode": "linux-gcc-x64" } ], "version": 4 }

Other Extensions

No response

Additional context

No response

huttuh commented 2 weeks ago

I encountered the same problem...

sean-mcmanus commented 2 weeks ago

@babaoglu53 @huttuh When you run the C/C++: Log Diagnostics command, do you see it repot an invalid configuration? Are you using -I with a system include? Does the issue not repro with 1.21.6?

babaoglu53 commented 2 weeks ago

The problem persists with both of them. Also the Log Diagnostics command outputs is as follows:

-------- Diagnostics - 10/29/2024, 12:08:55 AM
Version: 1.22.10
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/data/user1/projects/test/**"
    ],
    "defines": [],
    "compilerPath": "/usr/local/bin/g++",
    "intelliSenseMode": "linux-gcc-x64",
    "cppStandard": "c++14",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "/usr/local/bin/g++",
    "cStandard": "gnu23",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "/data/user1/projects/test/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.default.cStandard": "gnu23",
    "C_Cpp.default.cppStandard": "gnu++23"
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "always",
    "filesEncoding": "utf8",
    "filesAssociations": {},
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": true,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.22.10.0
Current database path: /home/user1/.cache/vscode-cpptools/b21412dcab1fff106533714f9fb12a21/.browse.VC.db
Translation Unit Mappings:
[ /data/user1/projects/test/newapp/NewApp.cpp - source TU]:
Translation Unit Configurations:
[ /data/user1/projects/test/newapp/NewApp.cpp ]
    Process ID: 12289
    Memory Usage: 10 MB
    Compiler Path: /usr/local/bin/g++
    Includes:
    System Includes:
        /usr/local/include/c++/5.4.0
        /usr/local/include/c++/5.4.0/x86_64-unknown-linux-gnu
        /usr/local/include/c++/5.4.0/backward
        /usr/local/lib/gcc/x86_64-unknown-linux-gnu/5.4.0/include
        /usr/local/include
        /usr/local/lib/gcc/x86_64-unknown-linux-gnu/5.4.0/include-fixed
        /usr/include
    Standard Version: c++14
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=50400
Total Memory Usage: 10 MB

==================================================================================

-------- Diagnostics - 10/29/2024, 12:11:20 AM
Version: 1.21.6
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/data/user1/projects/test/**"
    ],
    "defines": [],
    "compilerPath": "/usr/local/bin/g++",
    "intelliSenseMode": "linux-gcc-x64",
    "cppStandard": "c++14",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "/usr/local/bin/g++",
    "cStandard": "gnu23",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "/data/user1/projects/test/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.21.6.0
Translation Unit Mappings:
[ /data/user1/projects/test/newapp/NewApp.cpp - source TU]:
Translation Unit Configurations:
[ /data/user1/projects/test/newapp/NewApp.cpp ]:
    Process ID: 12584
    Memory Usage: 10 MB
    Compiler Path: /usr/local/bin/g++
    Includes:
    System Includes:
        /usr/local/include/c++/5.4.0
        /usr/local/include/c++/5.4.0/x86_64-unknown-linux-gnu
        /usr/local/include/c++/5.4.0/backward
        /usr/local/lib/gcc/x86_64-unknown-linux-gnu/5.4.0/include
        /usr/local/include
        /usr/local/lib/gcc/x86_64-unknown-linux-gnu/5.4.0/include-fixed
        /usr/include
    Standard Version: c++14
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=50400
Total Memory Usage: 10 MB

==================================================================================

gmake output:

gmake[1]: Entering directory /data/user1/projects/test/newapp' gmake[1]: Nothing to be done forupdate'. gmake[1]: Leaving directory /data/user1/projects/test/newapp' gmake[1]: Entering directory/data/user1/projects/test/newapp' g++ -std=c++14 -pipe -ftrack-macro-expansion=0 -Wall -Wempty-body -Wno-unused-local-typedefs -Wno-switch -Wno-parentheses -Wno-deprecated-declarations -g -O2 -I. -I../include -iprefix ../include/ pkg-config --cflags mylib -c NewApp.cpp -o build/devel/obj/NewApp.o g++ -o build/devel/out/newapp build/devel/obj/NewApp.o -static-libstdc++ -static-libgcc -L../lib pkg-config --static --libs mylib -rdynamic gmake[1]: Leaving directory `/data/user1/projects/test/newapp'

sean-mcmanus commented 2 weeks ago

@babaoglu53 I think gcc 5.4 was released in 2016, but your settings use gnu++23, which may require g++ 12 or newer. That might not be the issue though.

Can you try replacing "/data/user1/projects/test/**" with

"/data/user1/projects/test/newapp",
"/data/user1/projects/test/include"

or whatever other include directories you need?

It looks like something is causing the resolving of "**" in your includePath to fail, possibly due to a database issue.

Can you try doing a Reset IntelliSense Database after setting C_Cpp.loggingLevel to "Debug" and see if the "C/C++" window shows tag parsing messages or if there are database errors/failures?

sean-mcmanus commented 2 weeks ago

Also, you may want to confirm the database file /home/user1/.cache/vscode-cpptools/b21412dcab1fff106533714f9fb12a21/.browse.VC.db has write permissions.

babaoglu53 commented 2 weeks ago

I think the problem was .cache. I deleted and reinstalled everything related to .vscode-server and .cache on the remote server. Now it works as before. Thank you very much for your help.