microsoft / microsoft/vscode-cpptools
Header-only IntelliSense should use language ID delivered with `didOpen` instead of defaulting to C++
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
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
- Open x/y.h
- 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 Diagnosticsfrom 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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la gestione di textDocument/didOpen mostrata nel language-server log e con la configurazione header_only_fallback nei diagnostics. Verifica come viene usato il language ID fornito per x/y.h, poi riproduci il caso dell’header C e conferma che la sintassi C valida non riceva più squiggles specifici di C++.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, cpp, typescript
- Ambito
- developer-experience, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100