microsoft / microsoft/vscode-cpptools

Intellisense doesn't work correctly

Open
#12,753 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug investigate: repro Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: MacBook Pro Sonoma 14.5
  • VS Code Version: 1.93.1 (Universal)
  • C/C++ Extension Version: v1.21.6
Bug Summary and Steps to Reproduce

Bug Summary: The intellisense sometimes show errors that aren't present in the code and sometimes doesn't show error that are present in the code.

I also tried to change the compiler used by the intellisense with this command: C/C++: Select IntelliSense Configuration...
and the problem persist

Steps to reproduce:
write this on a file:
#include
#include

using namespace std;

int main(){
int a,b;
vector arr;
int index = lower_bound(arr.begin(),arr.end(),a) - arr.begin();
}

this generates a problem with the intellisense on line 10: "no suitable conversion function from "std::__1::__wrap_iter<std::__1::vector<int, std::__1::allocator>::pointer>" (aka "std::__1::__wrap_iter<int *>") to "int" exists"

Expected behavior:
there is no error and the code compiles fine

Configuration and Logs
c_cpp_properties.json:
{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "intelliSenseMode": "macos-clang-arm64"
        }
    ],
    "version": 4
}
Logs from the language server logging:
I cannot send them because they are too long and the request would exceed the 65536 limit of characters (added them in the logs)
Other Extensions

the issue is present even when c/c++ is the only installed/enabled extension

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported diagnostic with the provided C++ snippet, c_cpp_properties.json, and the listed macOS clang configuration. Review the language server logs referenced in the issue and compare IntelliSense diagnostics with the compiler result. Done means the valid lower_bound expression no longer produces a false error while genuine errors remain reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.