Search code examples
c++visual-studio-codeunreal

Visual Studio Code(vscode) collapsing methods/function arrow widgets are on the wrong line of code and collapse the wrong lines


I Have this CPP file in vscode, and I generally tend to collapse function I'm not currently working on, which makes it easier for me to navigate the file using the code preview scrollbar.

Here you can see the collapse arrow isn't properly aligned (2 line above) with the function stopSprinting

misaligned collapsable opened

When collapsing that arrow, this is what happens:

misaligned collapsable closed

Any idea what could cause this? I have a few extensions affecting C++ code, (notably, C/C++ by microsoft, and Better C++ Syntax by Jeff Hykin, and others, but they're about generating code, not browsing it) and I'm not sure if it could be causing this.

If this can be of any importance, I'm working on an Unreal Project and using vscode as the code editor.

Here's the output of the 'Help: About' command on vscode:

Version: 1.82.3 (user setup) Commit: fdb98833154679dbaa7af67a5a29fe19e55c2b73 Date: 2023-10-02T10:51:22.294Z Electron: 25.8.1 ElectronBuildId: 24153832 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Windows_NT x64 10.0.19045

As of now, I've closed/opened the file, closed/opened vscode entirely, disabled/enabled extensions while closing vscode in betweens, opened/closed all collapsed functions manually and automatically (Ctrl + K, Ctrl + J/0) to no avail. Anyone had this happened to them before and found a fix?


Solution

  • So, after testing some other stuff out, I did the most obvious thing I should've done at first, I removed the whitespace in between both function and "glued" them back to back:

    void AHumanoidCharacter::startSprinting()
    {
    
    }void AHumanoidCharacter::stopSprinting()
    {
    
    }
    

    and it has somehow reset the collapse widgets and they work as intented now. My guess would be a different character code was used to do the return since my keyboard sometimes switches language for whatever reason and it might have bugged out the intellisense and/or vscode computing internally. Hope this can help out!