microsoft / microsoft/vscode-cpptools

Request: Allow merge of `forcedInclude` setting from base config when using `compile_commands.json`

Offen
#8,274 12 Kommentare 12 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Feature Request Feature: Compile Commands Language Service
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

Bug type: General

Describe the bug

  • OS and Version: Latest Linux Mint
  • VS Code Version: 1.61
  • C/C++ Extension Version: v1.7.0

This bug should be pretty easy to reproduce, for example:

Create a header file suppress-warnings.h with contents:

#ifdef __INTELLISENSE__
// 20 - identifier is undefined
#pragma diag_suppress 20
#endif

Create main.cc with contents:

int main(int argc, char** argv) { fdsfsdsfd; }

Edit c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": ["${default}"],
            "defines": [],
            "compilerPath": "/usr/local/bin/clang++",
            "compileCommands": "${workspaceFolder}/compile_commands.json",
            "cStandard": "c17",
            "cppStandard": "gnu++20",
            "intelliSenseMode": "linux-clang-x64",
            "forcedInclude": [
                "${workspaceFolder}/suppress-warnings.h"
            ]
        }
    ],
    "version": 4
}

Example compile_commands.json (empty list won't break it):

[
  {
    "directory": "/path-to-workspace/build/src",
    "command": "true",
    "file": "/path-to-workspace/main.cc"
  }
]

Includes from forcedInclude are not included and do not suppress a warning.

If you comment compileCommands in c_cpp_properties.json - the forced include is included.

Expected behaviour:

forcedInclude is included when using compileCommands

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere das Verhalten mit c_cpp_properties.json, wobei compileCommands aktiviert ist, der Beispiel-compile_commands.json und suppress-warnings.h über forcedInclude eingebunden wird. Vergleiche das Ergebnis mit auskommentiertem compileCommands; abgeschlossen ist die Aufgabe, wenn das erzwungene Include in beiden Konfigurationen berücksichtigt und die Warnung unterdrückt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, vscode
Bereich
developer-experience, tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.