vscode icon indicating copy to clipboard operation
vscode copied to clipboard

folding messed up

Open raphael12333 opened this issue 1 year ago • 2 comments

Hi i use a cpp project

When using Sublime Text for a short time, the issue is gone after returning to VS Code but it comes back later, probably when using "Convert Indentation to Spaces"

Here is how it looks: Image

all my VS Code settings are default regards

raphael12333 avatar Oct 19 '24 01:10 raphael12333

here is another example Image

ghost avatar Oct 19 '24 01:10 ghost

i code like this:

if (x)
{
    do();
    do();
}
if(x)
    do();

and i use some #if 0 maybe these are causes

ghost avatar Oct 19 '24 06:10 ghost

Please provide the code example to reproduce. Also describe what exactly is messed up. Do you use an extension for C++?

aeschli avatar Oct 22 '24 09:10 aeschli

I do not manage to make a reproducible example The above screenshots show that the functions are not folded properly, do you see what i mean? I don't use C++ extension

i think it gets triggered when i do "Convert Indentation to Spaces", then fold all the only way i found to make it stop is to use sublime text for few hours and then come back

Do VS Code uses some config/cache file for the folding?

ghost avatar Oct 22 '24 11:10 ghost

Getting the issue right now: Image

There shouldn't be 2 arrows isn't it?

Here is the result when I press the second one: Image

This is what i mean by messed up It seems to me there is a bug that makes VS Code to propose to fold parts it shouldn't

So when I "fold all" sometimes (using ctrl+k+0), it folds stuff it shouldn't and then some parts of the file looks like the first screenshots i sent

below is the file i'm getting the issue with right now kc.zip

i don't remember having used "Convert Indentation to Spaces" before getting the issue now

ghost avatar Oct 23 '24 09:10 ghost

by ctrl+k+0, i mean i press this for 0 Image

with no shift/caps, so i guess i should say ctrl+k+à...

ghost avatar Oct 23 '24 09:10 ghost

If you don't use an extension, then you get folding based on indentation: A folding region starts when a line has a smaller indent than one or more following lines and ends when there is a line with the same or smaller indent.

You are right, there shouldn't be a folding marker on line 138, but on line 139

What could be an explanation is that when you do 'Convert Indentation to Spaces' and have regions folded, then we try to keep persisting the folded ranges.

You can remove these persisted ranges by selecting all and run the command Remove Manual Folding Ranges

I can't reproduce the issue. It would be interesting to get the content where line 137 has a folding range, just before you run Remove Manual Folding Ranges When you see this again, can you undo the Remove Manual Folding Ranges and get that content?

aeschli avatar Oct 24 '24 07:10 aeschli

Hello I just got the issue after running Convert Indentation to Spaces Selecting all and running Remove Manual Folding Ranges fixed it instantly, thank you very much

I kinda struggled to understand when you talked about the content to send but i hope the below will provide an equivalent for the requested information

I did ctrl+z to bring back the issue, it starts with this: Image

result after running the command: Image

here is the content of custom_GScr_LoadGameTypeScript:

void custom_GScr_LoadGameTypeScript()
{
    hook_GScr_LoadGameTypeScript->unhook();
    void (*GScr_LoadGameTypeScript)();
    *(int*)&GScr_LoadGameTypeScript = hook_GScr_LoadGameTypeScript->from;
    GScr_LoadGameTypeScript();
    hook_GScr_LoadGameTypeScript->hook();

    unsigned int i;
    
    if(*fs_callbacks_additional->string && !Scr_LoadScript(fs_callbacks_additional->string))
        Com_DPrintf("custom_GScr_LoadGameTypeScript: Scr_LoadScript for fs_callbacks_additional failed.\n");

    for (i = 0; i < sizeof(callbacks) / sizeof(callbacks[0]); i++)
    {
        if(callbacks[i].custom)
            *callbacks[i].pos = Scr_GetFunctionHandle(fs_callbacks_additional->string, callbacks[i].name);
        else
            *callbacks[i].pos = Scr_GetFunctionHandle(fs_callbacks->string, callbacks[i].name);

        /*if (*callbacks[i].pos && g_debugCallbacks->integer)
            Com_Printf("%s found @ %p\n", callbacks[i].name, scrVarPub.programBuffer + *callbacks[i].pos);*/ //TODO: verify scrVarPub_t
    }
}

Could the /**/ participate in triggering the issue? I talked about it with someone recently and he said: Image

Please let me know if there are other things i could do to help to figure out the cause (edit: taking a break of this language)

Regards

ghost avatar Oct 28 '24 17:10 ghost

As we discussed earlier, this is caused by the use of the Convert Indentation to Spaces feature together with the code that tries to preserve existing folded ranges.

I think this is a corner case and has not been reported except by you.

There are correctly no plans to investigate in a fix unless we get more reports.

aeschli avatar Dec 09 '24 20:12 aeschli

since the issue is not fixed, what about closing as not planned instead of completed?

ghost avatar Dec 09 '24 20:12 ghost

Yes, of course. It's only fixed if it has a milestone.

aeschli avatar Dec 09 '24 21:12 aeschli

The issue was closed as 'out-of-scope' (see the tag). That means we acknowledge this a s bug or missing feature, but do not plan to work on it. See here for the reasoning.

aeschli avatar Jan 07 '25 09:01 aeschli

no it wasn't closed as out of scope, it was closed as completed

it is not appropriate, see:

Image

ghost avatar Jan 07 '25 09:01 ghost

Oh, nice I wasn't aware if this feature of GitHub. Not sure when this got added so please understand that the convention in the VS Code repo is:

  • fixed: closed and milestone set
  • not fixed and not planed: closed and no milestone set

aeschli avatar Jan 07 '25 10:01 aeschli

I thought you knew, i apologize for having being cold etc then in my case i don't know what a milestone is

it's just that this issue is imo very annoying and i know i'm not the only one experiencing it

so i think it should at least be closed "as not planned", because currently this issue is stated as fixed but is not

seems to me "as completed" should only be used for when a problem is no more, do you agree?

if someday there would be some analyzing of unfixed issues -> this issue would be missed because stated "as completed" I believe this is the real problem here, i can understand you don't want or can't spend time on it, but for me it's difficult to let this issue archived with the fixed status because it is not and i believe it would not be fair to let it be this way, for the people experiencing it

ghost avatar Jan 07 '25 10:01 ghost

@aeschli @https://github.com/microsoft/vscode/issues/235576 you can read

Image

By "as "won't fix"", it looks like rebornix meant "as not planned", don't you think? I shouldn't ask you a question since you didn't reply to my previous one

@rebornix Hi, did you mean "as not planned"?

@aeschli if you don't use VSC for cpp, could you please reassign the issue to someone who does, maybe he would care

Or at least closing this issue properly would be a first good step

I don't plan to give up on it, if you ignore it i will just recreate like I did @https://github.com/microsoft/vscode/issues/237293

ghost avatar Jan 12 '25 04:01 ghost

Thank you aeschli

ghost avatar Jan 13 '25 11:01 ghost