microsoft / microsoft/vscode-cpptools

Header-only IntelliSense should use language ID delivered with `didOpen` instead of defaulting to C++

Offen
#9,138 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

Bug type: Language Service

Describe the bug

  • OS and Version: linux 5.17.1
  • VS Code Version: 1.65.2
  • C/C++ Extension Version: 1.9.7
  • Other extensions you installed (and if the issue persists after disabling them): dart, go, flutter, python, rust (literal names of the extensions)
  • If using SSH remote, specify OS of remote machine:
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc). Workspace is a project with a lot of go code and one file in c, a header file with just one line. This file is located at x/y.h. and contains void z(char *restrict q); which is valid C code. Language is set to C.

Steps to reproduce

  1. Open x/y.h
  2. See error

Expected behavior
No squiggly lines

Code sample and logs

  • Code sample
void z(char *restrict q);
  • Configurations in c_cpp_properties.json

  • Logs from running C/C++: Log Diagnostics from the VS Code command palette

-------- Diagnostics - 04/04/2022, 19:07:04
Version: 1.9.7
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "${workspaceFolder}/**"
    ],
    "defines": [],
    "compilerPath": "/sbin/clang",
    "cStandard": "c17",
    "cppStandard": "c++14",
    "intelliSenseMode": "linux-clang-x64",
    "compilerArgs": [],
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ /.../x/y.h ]:
    /.../x/y.h
Translation Unit Configurations:
[ /.../x/y.h ]:
    Process ID: 17136
    Memory Usage: 12 MB
    Compiler Path: /sbin/clang
    Includes:
        /usr/include/c++/11.2.0
        /usr/include/c++/11.2.0/x86_64-pc-linux-gnu
        /usr/include/c++/11.2.0/backward
        /usr/lib/clang/13.0.1/include
        /usr/local/include
        /usr/include
    Standard Version: c++14
    IntelliSense Mode: linux-clang-x64
    Other Flags:
        --clang
        --clang_version=130001
        --header_only_fallback
Total Memory Usage: 12 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 26971
Number of files parsed: 3712

- Logs from [the language server logging](https://code.visualstudio.com/docs/cpp/enable-logging-cpp#_enable-logging-for-the-language-server)
loggingLevel: Debug
loggingLevel has changed to: Debug
cpptools/didChangeCppProperties
$/setTraceNotification
cpptools/getCodeActions: /.../x/y.h (id: 149)
cpptools/textEditorSelectionChange
cpptools/textEditorSelectionChange
cpptools/activeDocumentChange: /.../x/y.h
cpptools/getFoldingRanges: /.../x/y.h (id: 150)
cpptools/getCodeActions: /.../x/y.h (id: 151)
textDocument/didClose: /.../x/y.h
Database safe to open
cpptools/getCodeActions: /.../x/y.h (id: 152)
textDocument/didOpen: /.../x/y.h
Checking for syntax errors: /.../x/y.h
Queueing IntelliSense update for files in translation unit of: /.../x/y.h
cpptools/textEditorSelectionChange
cpptools/getDocumentSymbols: /.../x/y.h (id: 153)
cpptools/textEditorSelectionChange
cpptools/getSemanticTokens: /.../x/y.h (id: 154)
cpptools/getDocumentSymbols
cpptools/activeDocumentChange: /.../x/y.h
cpptools/getFoldingRanges: /.../x/y.h (id: 155)
cpptools/getCodeActions: /.../x/y.h (id: 156)
cpptools/finishUpdateSquiggles
Error squiggle count: 1
terminating child process: 18585
Update IntelliSense time (sec): 0.367
cpptools/getCodeActions: /.../x/y.h(id: 157)
cpptools/getFoldingRanges: /.../x/y.h (id: 158)
cpptools/textEditorSelectionChange
cpptools/activeDocumentChange: /.../x/y.h

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

Beginne mit der textDocument/didOpen-Behandlung im language-server log und der header_only_fallback-Konfiguration in den diagnostics. Überprüfe, wie die gelieferte language ID für x/y.h verwendet wird, reproduziere dann den Fall mit dem C-Header und bestätige, dass gültige C-Syntax keine C++-spezifischen Squiggles mehr erhält.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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