Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hover over static constexpr variables does not show evaluation result #12284

Open
diablodale opened this issue May 6, 2024 · 3 comments
Open
Labels
bug Language Service Visual Studio Inherited from Visual Studio
Milestone

Comments

@diablodale
Copy link

Environment

  • OS and Version: Microsoft Windows [Version 10.0.22631.3447]
  • VS Code Version: 1.89.0 (system setup)
  • C/C++ Extension Version: 1.19.9
  • If using SSH remote, specify OS of remote machine:

Bug Summary and Steps to Reproduce

Summary

Some combinations of static/not for constexpr formula are not evaluated by intellisense hover. Statements as static constexpr... sometimes do not evaluate.

Setup

  • as above
  • VS 2022 Community 17.9.6

Repro

  1. Create vscode folder, cmakelists.txt, to configure and compile below c++17 code
  2. Over over the 8 variable names to see which are evaluated and show their result
int main() {

    // hover over both variable names, left side of operator=() ...

    // shows 5 and 10
    constexpr int case1a = 5;
    constexpr int case1b = case1a * 2;

    // shows 5 and 10
    static constexpr int case2a = 5;
    constexpr int case2b = case2a * 2;

    // shows only 5
    constexpr int case3a = 5;
    static constexpr int case3b = case3a * 2;

    // shows only 5
    static constexpr int case4a = 5;
    static constexpr int case4b = case4a * 2;

    return 0;
}

Result

Only 6 of 8 variables have their results evaluated on hover. Two of the static constexpr... fail to show their result.

Expected

All 8 variables show their evaluated result on hover.

Configuration and Logs

No c_cpp_properties.json
-------- Diagnostics - 5/6/2024, 3:25:47 PM
Version: 1.19.9
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.22621.0",
    "compilerPath": "cl.exe",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-x64",
    "compilerPathInCppPropertiesJson": "cl.exe",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "configurationProvider": "ms-vscode.cmake-tools",
    "browse": {
        "path": [
            "c:/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Custom browse configuration: 
{
    "browsePath": [
        "c:/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src",
        "c:/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/include"
    ],
    "compilerPath": "c:/program files/microsoft visual studio/2022/community/vc/tools/msvc/14.39.33519/bin/hostx64/x64/cl.exe",
    "compilerArgs": [],
    "compilerFragments": [
        "/DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -std:c++17 -MDd -Zi"
    ]
}
cpptools version (native): 1.19.9.0
Translation Unit Mappings:
[ C:\repos-nobackup\cpptools-bug-hover-constexpr\my-cpp-project\include\other_classes.h - source TU]:
[ C:\repos-nobackup\cpptools-bug-hover-constexpr\my-cpp-project\src\main.cpp - source TU]:
Translation Unit Configurations:
[ C:\repos-nobackup\cpptools-bug-hover-constexpr\my-cpp-project\include\other_classes.h ]:
    Process ID: 11512
    Memory Usage: 49 MB
    Compiler Path: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl.exe
    Includes:
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\atlmfc\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt
    Defines:
        WIN32
        _WINDOWS
    Standard Version: ms_c++17
    IntelliSense Mode: windows-msvc-x64
[ C:\repos-nobackup\cpptools-bug-hover-constexpr\my-cpp-project\src\main.cpp ]:
    Process ID: 31836
    Memory Usage: 54 MB
    Compiler Path: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl.exe
    Includes:
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include
        C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\atlmfc\include
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\winrt
        C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\cppwinrt
    Defines:
        WIN32
        _WINDOWS
    Standard Version: ms_c++17
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 103 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5032
loggingLevel: Debug
loggingLevel has changed to: Debug
LSP: (received) cpptools/fileCreated: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/.vscode
LSP: (invoked) cpptools/didChangeCppProperties (id: 1206)
LSP: Sending response (id: 1206)
LSP: (invoked) cpptools/fileCreated: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/.vscode
LSP: (received) cpptools/fileCreated: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/.vscode/settings.json
LSP: (invoked) cpptools/fileCreated: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/.vscode/settings.json
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp
LSP: (received) cpptools/didChangeActiveEditor: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp
LSP: (received) cpptools/getCodeActions: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1207)
LSP: (invoked) cpptools/didChangeActiveEditor: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1207)
LSP: Sending response (id: 1207)
LSP: (invoked) cpptools/didChangeTextEditorSelection
IntelliSense update scheduled and TU acquisition started for: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp
Update IntelliSense time (sec): 0.002
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1208)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1208)
LSP: Sending response (id: 1208)
LSP: (received) cpptools/getCodeActions: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1209)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1209)
LSP: Sending response (id: 1209)
LSP: (received) cpptools/getDocumentSymbols: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1210)
LSP: (invoked) cpptools/getDocumentSymbols: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1210)
LSP: Sending response (id: 1210)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp
LSP: (invoked) cpptools/didChangeActiveEditor: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1211)
LSP: (invoked) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1211)
LSP: Sending response (id: 1211)
LSP: $/cancelRequest (<unknown/completed>, id: 1211)
LSP: (received) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1212)
LSP: (invoked) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1212)
LSP: Sending response (id: 1212)
LSP: (received) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1213)
LSP: (invoked) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1213)
LSP: Sending response (id: 1213)
LSP: (received) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1214)
LSP: (invoked) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1214)
LSP: Sending response (id: 1214)
LSP: (received) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1215)
LSP: (invoked) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1215)
LSP: Sending response (id: 1215)
LSP: (received) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1216)
LSP: (invoked) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1216)
LSP: Sending response (id: 1216)
LSP: (received) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1217)
LSP: (invoked) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1217)
LSP: Sending response (id: 1217)
LSP: (received) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1218)
LSP: (invoked) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1218)
LSP: Sending response (id: 1218)
LSP: (received) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1219)
LSP: (invoked) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1219)
LSP: Sending response (id: 1219)
LSP: (received) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1220)
LSP: (invoked) textDocument/hover: file:///c%3A/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp (id: 1220)
LSP: Sending response (id: 1220)


### Other Extensions

_No response_

### Additional context

_No response_
@diablodale
Copy link
Author

Also reproduces with same OP except...

  • Open VSCode to WSL Ubuntu 20.04 LTS
  • Use kit gcc-9
-------- Diagnostics - 5/6/2024, 3:42:18 PM
Version: 1.19.9
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/mnt/c/repos-nobackup/cpptools-bug-hover-constexpr/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/gcc",
    "cStandard": "c17",
    "cppStandard": "gnu++14",
    "intelliSenseMode": "linux-gcc-x64",
    "compilerPathInCppPropertiesJson": "/usr/bin/gcc",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "mergeConfigurations": false,
    "compilerPathIsExplicit": false,
    "browse": {
        "path": [
            "/mnt/c/repos-nobackup/cpptools-bug-hover-constexpr/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.19.9.0
Translation Unit Mappings:
[ /mnt/c/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp - source TU]:
Translation Unit Configurations:
[ /mnt/c/repos-nobackup/cpptools-bug-hover-constexpr/my-cpp-project/src/main.cpp ]:
    Process ID: 57904
    Memory Usage: 11 MB
    Compiler Path: /usr/bin/gcc
    Includes:
        /usr/include/c++/9
        /usr/include/x86_64-linux-gnu/c++/9
        /usr/include/c++/9/backward
        /usr/lib/gcc/x86_64-linux-gnu/9/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c++14
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=90400
Total Memory Usage: 11 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 2498

@sean-mcmanus sean-mcmanus self-assigned this May 7, 2024
@sean-mcmanus sean-mcmanus added this to the Tracking milestone May 7, 2024
@sean-mcmanus sean-mcmanus added the Visual Studio Inherited from Visual Studio label May 7, 2024
@sean-mcmanus
Copy link
Collaborator

@diablodale I've filed a bug on our shared VS implementation at https://developercommunity.visualstudio.com/t/C-IntelliSense-doesnt-show-the-hover/10653170 .

@sean-mcmanus sean-mcmanus removed their assignment May 7, 2024
@diablodale
Copy link
Author

got it. Does that team also own the code that is used in WSL with GCC? I thought there were separate components provided by the GCC project for hover/parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Language Service Visual Studio Inherited from Visual Studio
Projects
None yet
Development

No branches or pull requests

2 participants