Bug type: Language Service
Describe the bug
- OS and Version: Arch Linux
- VS Code Version: 1.56.0-insider
- C/C++ Extension Version: v1.5.0-insiders2
- Other extensions you installed (and if the issue persists after disabling them): N/A
- If using SSH remote, specify OS of remote machine: SSH remote on Arch Linux
Steps to reproduce
- Open workspace
- Reset IntelliSense database
- Open one file with source code
- Find a function call that refers to a function outside of the current file.
- Click "Go to definition"
- See that declaration is opened
- Open and close the file with the definition
- Click "Go to definition" again
- See that definition is opened
Expected behavior
The function definition is opened on first click too
Code sample and logs
In the logs below filenames and paths are changed.
foo.c is file that calls bar()
bar.h is the header, that declares bar() function
bar.c is file that defines bar() function
- Configurations in
c_cpp_properties.json
{
"env": {},
"configurations": [
{
"name": "Linux",
"intelliSenseMode": "linux-clang-arm",
"includePath": [
"${workspaceFolder}/include",
// other project-releated includes
],
"defines": [],
"forcedInclude": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c89",
"cppStandard": "c++17",
"browse": {
"path": [
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ".vscode/browse.db"
},
"compilerArgs": [
"-O3",
"-pipe",
"-W",
"-Wall",
"-Wpointer-arith",
"-Wcast-align",
"-std=gnu99",
"-pedantic",
"-Wformat=0",
"-Wno-format-zero-length",
"-Wno-unused-but-set-variable",
"-Wdeclaration-after-statement",
"-Wformat",
"-fno-strict-aliasing",
"-fshort-enums",
"-fPIC",
"-funwind-tables"
]
}
],
"version": 4
}
- Logs from running
C/C++: Log Diagnostics from the VS Code command palette
-------- Diagnostics - 6/22/2021, 8:22:36 PM
Version: 1.5.0-insiders2
Current Configuration:
{
"name": "Linux",
"intelliSenseMode": "linux-clang-arm",
"includePath": [
"${workspaceFolder}/include",
// other includes
],
"defines": [
],
"forcedInclude": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c89",
"cppStandard": "c++17",
"browse": {
"path": [
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ".vscode/browse.db"
},
"compilerArgs": [
"-O3",
"-pipe",
"-W",
"-Wall",
"-Wpointer-arith",
"-Wcast-align",
"-std=gnu99",
"-pedantic",
"-Wformat=0",
"-Wno-format-zero-length",
"-Wno-unused-but-set-variable",
"-Wdeclaration-after-statement",
"-Wformat",
"-fno-strict-aliasing",
"-fshort-enums",
"-fPIC",
"-funwind-tables"
],
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true,
"compileCommands": "${workspaceFolder}/compile_commands.json"
}
Translation Unit Mappings:
[ /path/to/foo.c ]:
/path/to/foo.c
/path/to/bar.h
Translation Unit Configurations:
[ /path/to/foo.c ]:
Process ID: 4030958
Memory Usage: 55 MB
Compiler Path: /usr/bin/clang
Includes:
/path/to/include
Defines:
Standard Version: c99
IntelliSense Mode: linux-gcc-arm
Other Flags:
--gcc
--gnu_version=40603
Total Memory Usage: 55 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 1705
Checking for syntax errors: file:///path/to/foo.c
Queueing IntelliSense update for files in translation unit of: /path/to/foo.c
cpptools/getCodeActions: file:///path/to/foo.c (id: 2)
cpptools/activeDocumentChange: file:///path/to/foo.c
cpptools/textEditorSelectionChange
cpptools/getDocumentSymbols: file:///path/to/foo.c (id: 3)
cpptools/getDocumentSymbols
cpptools/getCodeActions: file:///path/to/foo.c (id: 4)
cpptools/getFoldingRanges: file:///path/to/foo.c (id: 5)
cpptools/getSemanticTokens: file:///path/to/foo.c (id: 6)
cpptools/finishUpdateSquiggles
Error squiggle count: 0
terminating child process: 4031004
Update IntelliSense time (sec): 0.57
cpptools/getCodeActions: file:///path/to/foo.c (id: 7)
cpptools/activeDocumentChange: file:///path/to/foo.c
cpptools/textEditorSelectionChange
textDocument/hover: file:///path/to/foo.c (id: 8)
cpptools/activeDocumentChange: file:///path/to/foo.c
cpptools/textEditorSelectionChange
textDocument/hover: file:///path/to/foo.c (id: 9)
textDocument/hover: file:///path/to/foo.c (id: 10)
textDocument/definition: file:///path/to/foo.c (id: 11)
cpptools/getCodeActions: file:///path/to/bar.h|% (id: 12)
textDocument/didOpen: file:///path/to/bar.h|%
Checking for syntax errors: file:///path/to/bar.h|%
Queueing IntelliSense update for files in translation unit of: /path/to/foo.c
cpptools/activeDocumentChange: file:///path/to/bar.h|%
cpptools/textEditorSelectionChange
cpptools/getDocumentSymbols: file:///path/to/bar.h|% (id: 13)
cpptools/textEditorSelectionChange
cpptools/getDocumentSymbols
tag parsing file: /path/to/bar.h|%
textDocument/documentHighlight: file:///path/to/bar.h|% (id: 14)
cpptools/getSemanticTokens: file:///path/to/bar.h|% (id: 15)
cpptools/getCodeActions: file:///path/to/bar.h|% (id: 16)
cpptools/getFoldingRanges: file:///path/to/bar.h|% (id: 17)
cpptools/finishUpdateSquiggles
Error squiggle count: 0
Error squiggle count: 0
terminating child process: 4031137
Update IntelliSense time (sec): 0.257
cpptools/getCodeActions: file:///path/to/bar.h|% (id: 18)
textDocument/hover: file:///path/to/bar.h|% (id: 19)
cpptools/getSemanticTokens: file:///path/to/foo.c (id: 20)
cpptools/getCodeActions: file:///path/to/bar.h|% (id: 21)
textDocument/hover: file:///path/to/bar.h|% (id: 22)
Database safe to open
Some info from the database:
$ sqlite3 .vscode/browse.db 'SELECT * FROM code_items WHERE name="bar";'
8|1706|0|22|1|bar|int |1|45|75|45|10|45|30|45|||||||bar
$ sqlite3 .vscode/browse.db 'SELECT * FROM files WHERE id=1706;'
1706|1621580740|0.0|0.0|0.0|/path/to/bar.h|bar.h|0|00000000000000000000000000000000
Bug type: Language Service
Describe the bug
Steps to reproduce
Expected behavior
The function definition is opened on first click too
Code sample and logs
In the logs below filenames and paths are changed.
foo.cis file that callsbar()bar.his the header, that declaresbar()functionbar.cis file that definesbar()functionc_cpp_properties.jsonC/C++: Log Diagnosticsfrom the VS Code command paletteSome info from the database: