-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Bug type: Language Service
Describe the bug
- OS and Version: Windows 10 Pro 21H2
- VS Code Version: 1.63.2
- C/C++ Extension Version: 1.8.0 preview (but I've seen this in the last week or two, on some earlier version)
- Other extensions you installed (and if the issue persists after disabling them): Several, and I don't have the time right now to go fishing for this, but I can demo and allow control of my machine for investigation if needed.
- If using SSH remote, specify OS of remote machine: No
- 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).
All versions of "go to definition" (mouse float tooltip, go to definiton, peek definition, peek type definition...) are giving me patently nonsensical results for some definitions. Usually (maybe always, I need to pay more attention over time), what I get is the definition of some macro from sal.h, not always the same one.
Two things of note:
1- This happens both in our smaller project (we use CMake-tools for building) and in the Windows codebase (I work at MS) which doesn't use CMake.
2- The mouse float tooltip will show completely different definitions depending on which character of the identifier I float over. Usually, they are all different SAL macros. The one I'm looking at actually gives me the correct definition in the tooltip if I float over the last couple of characters of the identifier. But go to or peek definition always inevitably takes me only to the definitions shown if I float over the first couple of characters.
That last one is probably a good clue to what's going on here.
Steps to reproduce
- Only for some identifiers in my source code, use any of go to definition, peek definition or float the mouse over it.
- Observe the wrong definition.
Expected behavior
Correct definitions shown and traveled to.
Code sample and logs
-
Code sample
none -
Configurations in
c_cpp_properties.json
none -
Logs from running
C/C++: Log Diagnosticsfrom the VS Code command palette
-------- Diagnostics - 1/20/2022, 10:15:56 AM
Version: 1.8.0
Current Configuration:
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${vcpkgRoot}/x64-windows/include",
"${vcpkgRoot}/x86-windows/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.22000.0",
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.31.30818/bin/Hostx64/x64/cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64",
"compilerArgs": [],
"intelliSenseModeIsExplicit": false,
"cStandardIsExplicit": false,
"cppStandardIsExplicit": false,
"mergeConfigurations": false,
"compilerPathIsExplicit": false,
"configurationProvider": "ms-vscode.cmake-tools",
"browse": {
"path": [
"${workspaceFolder}/**",
"${vcpkgRoot}/x64-windows/include",
"${vcpkgRoot}/x86-windows/include"
],
"limitSymbolsToIncludedHeaders": true
}
}
Custom browse configuration:
{
"browsePath": [
... censored ...
],
"compilerPath": "c:/program files/microsoft visual studio/2022/preview/vc/tools/msvc/14.31.30818/bin/hostx64/x64/cl.exe",
"compilerArgs": []
}
Custom configurations:
[ X:\... censored ....cpp ]
{
"defines": [
"DBG",
"NOMINMAX",
... censored ...
"UNICODE",
"_NO_CRT_STDIO_INLINE",
"_SCL_SECURE_NO_WARNINGS",
"_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING",
"_UNICODE"
],
"standard": "c++17",
"includePath": [
... censored ...
],
"compilerPath": "c:/program files/microsoft visual studio/2022/preview/vc/tools/msvc/14.31.30818/bin/hostx64/x64/cl.exe",
"compilerArgs": [
"-MTd",
"/EHs-c-",
"/Odi",
"/Brepro",
"/Z7",
"/d2Zi+",
"/Zl",
"/Zp8",
"/GF",
"/ZH:SHA_256",
"-permissive-",
"/FC",
"/bigobj",
"/W4",
"/WX",
"/GR-",
"/Gw",
"/Gy",
"/wd4324",
"/wd4499",
"/Qspectre",
"/await",
"/GS",
"/guard:cf",
"-std:c++17"
... censored ...
]
}
Translation Unit Mappings:
[ X:\... censored ....cpp ]:
X:\... censored ....cpp
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h *
Translation Unit Configurations:
[ X:\... censored ....cpp ]:
Process ID: 38908
Memory Usage: 197 MB
Compiler Path: c:/program files/microsoft visual studio/2022/preview/vc/tools/msvc/14.31.30818/bin/hostx64/x64/cl.exe
Includes:
... censored ...
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\VC\TOOLS\MSVC\14.31.30818\INCLUDE
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\VC\TOOLS\MSVC\14.31.30818\ATLMFC\INCLUDE
C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22000.0\UM
C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22000.0\UCRT
C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22000.0\SHARED
C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22000.0\WINRT
C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22000.0\CPPWINRT
Defines:
DBG
NOMINMAX
... censored ...
UNICODE
_NO_CRT_STDIO_INLINE
_SCL_SECURE_NO_WARNINGS
_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING
_UNICODE
Standard Version: ms_c++17
IntelliSense Mode: windows-msvc-x64
Other Flags:
--pack_alignment
8
--no_ms_permissive
--no_rtti
--ms_await
Total Memory Usage: 197 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 6402
Number of files parsed: 512
- Logs from the language server logging
loggingLevel: Debug
loggingLevel has changed to: Debug
cpptools/didChangeCppProperties
$/setTraceNotification
cpptools/fileChanged: C:\Users\jcab\AppData\Roaming\Code\User\settings.json
Checking for syntax errors: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h
Queueing IntelliSense update for files in translation unit of: X:\... censored ....cpp
cpptools/fileChanged: C:\Users\jcab\AppData\Roaming\Code\User\settings.json
Checking for syntax errors: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h
Queueing IntelliSense update for files in translation unit of: X:\... censored ....cpp
cpptools/finishUpdateSquiggles
Error squiggle count: 16
Error squiggle count: 0
Update IntelliSense time (sec): 0.613
loggingLevel has changed to: Error
cpptools/didChangeSettings
IntelliSense Engine = Default.
Enhanced Colorization is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Autocomplete is enabled.
loggingLevel has changed to: Debug
cpptools/didChangeCppProperties
$/setTraceNotification
cpptools/getCodeActions: X:\... censored ....cpp (id: 100)
cpptools/textEditorSelectionChange
cpptools/getDocumentSymbols: X:\... censored ....cpp (id: 101)
cpptools/textEditorSelectionChange
cpptools/activeDocumentChange: X:\... censored ....cpp
cpptools/getDocumentSymbols
cpptools/getFoldingRanges: X:\... censored ....cpp (id: 102)
cpptools/getCodeActions: X:\... censored ....cpp (id: 103)
idle loop: reparsing the active document
Checking for syntax errors: X:\... censored ....cpp
Queueing IntelliSense update for files in translation unit of: X:\... censored ....cpp
cpptools/finishUpdateSquiggles
Error squiggle count: 16
Error squiggle count: 0
Update IntelliSense time (sec): 0.318
cpptools/getFoldingRanges: X:\... censored ....cpp (id: 104)
cpptools/getCodeActions: X:\... censored ....cpp (id: 105)
textDocument/hover: X:\... censored ....cpp (id: 106)
textDocument/hover: X:\... censored ....cpp (id: 107)
textDocument/hover: X:\... censored ....cpp (id: 108)
textDocument/hover: X:\... censored ....cpp (id: 109)
textDocument/hover: X:\... censored ....cpp (id: 110)
textDocument/hover: X:\... censored ....cpp (id: 111)
Request canceled: 111
textDocument/hover: X:\... censored ....cpp (id: 112)
textDocument/hover: X:\... censored ....cpp (id: 113)
textDocument/hover: X:\... censored ....cpp (id: 114)
cpptools/textEditorSelectionChange
cpptools/textEditorSelectionChange
cpptools/activeDocumentChange: X:\... censored ....cpp
cpptools/getCodeActions: X:\... censored ....cpp (id: 115)
textDocument/definition: X:\... censored ....cpp (id: 116)
cpptools/getCodeActions: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h (id: 117)
cpptools/getFoldingRanges: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h (id: 118)
cpptools/getCodeActions: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h (id: 119)
textDocument/hover: X:\... censored ....cpp (id: 120)
textDocument/definition: X:\... censored ....cpp (id: 121)
cpptools/getCodeActions: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h (id: 122)
cpptools/textEditorSelectionChange
cpptools/getDocumentSymbols: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h (id: 123)
cpptools/textEditorSelectionChange
cpptools/getDocumentSymbols
cpptools/activeDocumentChange: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h
cpptools/getFoldingRanges: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h (id: 124)
cpptools/getCodeActions: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h (id: 125)
idle loop: reparsing the active document
Checking for syntax errors: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h
Queueing IntelliSense update for files in translation unit of: X:\... censored ....cpp
cpptools/finishUpdateSquiggles
Error squiggle count: 16
Error squiggle count: 0
Update IntelliSense time (sec): 0.325
cpptools/getFoldingRanges: C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.31.30818\include\sal.h (id: 126)
That's a few mouse floats on different parts of the identifier (giving different definitions), and then a peek definition and then a go to definition.
Screenshots
I can add screen snips if needed, but they wouldn't add any new information.
Additional context
None