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

IntelliSense Include suggestion leaves extra '>' symbol #11042

Closed
ImaginaryExponent opened this issue Jun 3, 2023 · 3 comments
Closed

IntelliSense Include suggestion leaves extra '>' symbol #11042

ImaginaryExponent opened this issue Jun 3, 2023 · 3 comments
Assignees
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Milestone

Comments

@ImaginaryExponent
Copy link

Environment

  • OS and Version: Windows_NT x64 10.0.19044
  • VS Code Version: 1.79.0-insider (user setup), commit 506cd5056d875ccdbea2e9a41ba7b9f19103d599
  • C/C++ Extension Version: v1.16.0

Bug Summary and Steps to Reproduce

Bug Summary:
While editing #include <|> lines, if IntelliSense provides suitable hint, applying that hint via Tab or Enter sometimes introduces an extra closing angle bracket.

Steps to reproduce:

  1. Create an mepty 'proj' folder for the project.
  2. In the 'proj' folder create an empty main.cpp file.
  3. In the 'proj' folder create a 'fld1' sub-folder.
  4. In the 'proj/fld1' folder create a 'fld2' sub-folder.
  5. In the 'proj/fld1' subfolder create an empty hdr1.h.
  6. In the 'proj/fld1/fld2' subfolder create an empty hdr2.h.
  7. In the 'proj/main.cpp' type #include <fld1/fld2/hdr2.h>
  8. Try editing the #include line to #include <fld1/hdr1.h>. Use IntelliSense suggestion when it is offered.
  9. Using IntelliSense suggestion inserts selected item as #include <fld1/hdr1.h>>. Note the second >.

Expected behavior:
The > symbol is not inserted where not needed.

Most frequently this happens when the new #include <> path is shorter than the existing one. Like if some string IntelliSense composes is one character too long and copies extra > or on the contrary, one character too short and does not see the existing >.

Configuration and Logs

-------- Diagnostics - 6/3/2023, 9:52:20 AM
Version: 1.16.0
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "d:\\src\\_private_\\temp/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.22000.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": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ D:\src\_private_\temp\fld1\fld2\hdr2.h ]:
    D:\src\_private_\temp\fld1\fld2\hdr2.h
[ D:\src\_private_\temp\main.cpp ]:
    D:\src\_private_\temp\main.cpp
Translation Unit Configurations:
[ D:\src\_private_\temp\fld1\fld2\hdr2.h ]:
    Process ID: 19004
    Memory Usage: 48 MB
    Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe
    Includes:
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\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:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++17
    IntelliSense Mode: windows-msvc-x64
    Other Flags:
        --header_only_fallback
[ D:\src\_private_\temp\main.cpp ]:
    Process ID: 24052
    Memory Usage: 48 MB
    Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe
    Includes:
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include
        C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\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:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: ms_c++17
    IntelliSense Mode: windows-msvc-x64
Total Memory Usage: 97 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5264
Number of files parsed: 5

-----------------------------------------------------------
c_cpp_properties.json is not created in the folder. User settings are default.

Other Extensions

CMake Microsoft extension,
CMake Tools extension

Additional context

No response

@ImaginaryExponent ImaginaryExponent changed the title Include suggestion leaves extra '>' symbol IntelliSense Include suggestion leaves extra '>' symbol Jun 3, 2023
@bobbrow
Copy link
Member

bobbrow commented Jun 6, 2023

Thank you for reporting this issue. It didn't always happen for me. When it did, it seemed to be because there was a . (for the .h) between the cursor and the closing >.

@bobbrow bobbrow added this to the On Deck milestone Jun 6, 2023
@bobbrow bobbrow self-assigned this Jun 14, 2023
@bobbrow bobbrow added the fixed Check the Milestone for the release in which the fix is or will be available. label Jun 27, 2023
@sean-mcmanus sean-mcmanus modified the milestones: On Deck, 1.17.0 Jul 21, 2023
@michelleangela
Copy link
Contributor

@ImaginaryExponent
Copy link
Author

Tested on the v1.17.0 preview, looks good.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Projects
None yet
Development

No branches or pull requests

4 participants