Closed AgamlaRage closed 3 years ago
@AgamlaRage Ya, I can reproduce the issue with VS Code 1.48.0. I will look at what has been changed into VS Code.
I can't locate the regression since no code regarding the folding has recently been modified... You can try my spin of VS Code (MrCode) which doesn't suffer from this issue...
@daiyam I have this issue since I installed your extension (~1year).
I don't think the problem comes from a recent change.
I didn't report it because I found this workaround (modifying settings.json
) that take me only a few seconds when I start VS Code again.
I will give a look to your MrCode for sure!
So you had the issue before the updates I've made this spring ?
@daiyam Yes, I think so. As long as I remember using your plugin, I had this issue. I use your plugin, at least, since July 2019 (The proof is the issue I reported at this time #8 )
Wow, I can't believe I've never catch this bug (I've always run a custom build to be able to control the folding...). I've tested on VS Code 1.36.1 and the bug is there. Damn! I will try to fix it asap but it might take some time...
@AgamlaRage I've found the bug and a fix is on its way. Basically, the registry provides the folding providers in an FILO way. Since the extensions providers are registered before the default ones, you get the issue you are getting. (By editing the config, you are re-registering the providers) The fastest fix, it's to add a delay on the first registration of the providers... by default, it will be: 1000ms
@daiyam Sounds great! Thx for your reactivity.
As an additional idea : Be able to set a custom delay using VS Code settings.json
(You already seem to had this idea, but just in case).
I've already added it: explicitFolding.startupDelay
:wink:
The new version is up. Tell me if everything is ok.
Explicit Folding 0.9.0
I confirm that is working for the open AND visible files languages.
But it's initialized only:
Right Click + Open with VS Code
vscode.exe
or open blank workspace).js
, .php
, .scss
)Let say we have a workspace with a .php
file visible. And a .js
file, that is also open but not visible because on an other tab.
.php
file (The file that is visible when VS Code starts).js
file. Explicit Folding is not working for Javascript filesLet say we have a workspace with .js
file visible. A .php
file AND a .scss
file, that are also open but not visibles because on an other tabs.
.js
file (The file that is visible when VS Code starts).php
file. Explicit folding is working (I don't know why).scss
file. Explicit folding is not working (As intended, like in Test2)In this case (Test 3), .php
files don't need to be visible on a tab for Explicit Folding to work.
This happend only with .php
files.
Also tested with no PHP extension enabled on VS Code, same result.
Maybe the only way is to re-initialized the extension every time a language is initialized. (But I don't know if it's possible)
Ya, I'm having the same issues... Still the same bug, the default foldings are overwriting the foldings provided by the extension... My hacky way doesn't work in those cases. The PR microsoft/vscode#54200 would be the perfect fix since we could select which folding providers to use (default one or this extension). I will try to revive the PR or find another bypass.
@AgamlaRage Thanks you for your detailed reports, it was of great help. I have a more hacky way to fix the issue but I can push it directly to the extension because it would require to list all the languages... Let me explain so you can try it.
In the file package.json
(located at %USERPROFILE%\.vscode\extensions\zokugun.explicit-folding-0.9.0
), if you replace:
"activationEvents": [
"*"
],
with
"activationEvents": [
"onLanguage:javascript",
"onLanguage:php",
"onLanguage:scss",
"*"
],
and restart VS Code, the extension will be reloaded when a file in those languages is viewed.
Hello,
it seems to work randomly. I made two GIF to show you what is happening but I can't find an explanation or a pattern.
Modifications
activationEvents
is updated inside %USERPROFILE%\.vscode\extensions\zokugun.explicit-folding-0.9.0\package.json
settings.json
: "explicitFolding.startupDelay": 4000,
TEST 1:
TEST 2:
PS:
VSCode reloads the extensions when it's viewing a new file type. Keep explicitFolding.startupDelay
at 1000
and wait just after viewing a new file type.
You should try MrCode which avoids any conflict between folding providers.
@daiyam Sorry, no. I have no time to code at the moment, I also didn't open VSCode in a while (I hope soon). If you prefer to close the issue, I'll understand.
When doing a final review of your issue and still able to reproduce the issue, I've found the solution: using deferred provider. So the real folding provider is always loaded after the language's folding provider which fix the issue. I just wonder why I haven't thought of that solution before...
The fix is in the version v0.13.0
.
@daiyam Hello, since I updated to v0.13.0
I didn't see this bug again! š„ š„ š„
Thank you so much
I'm happy that it's finally working but it's a hacky solution. Basically, when the deferred provider is called to provide the folding ranges of a file, for only the first time, it will register of the real provider (with the delay) and will unregister itself.
VS Code 1.48.0 Explicit Folding 0.8.2
Issue
When opening VS Code the Explicit Folding extension seems to not be initialized.
In my case, the extension won't work until I refresh the
settings.json
by adding/removing/commenting any folding setting key.GIF explanation:
style.scss
)settings.json
settings.json
Tests
Config
Here is my Explicit Folding config in VS Code
settings.json
settings.json
```json { "folding": { "javascript": [ { "begin": "/*", "end": "*/", }, { "begin": "(", "end": ")", }, { "begin": "[", "end": "]", }, { "begin": "{", "end": "}", }, ], "json": [ { "begin": "{", "end": "}" }, { "begin": "[", "end": "]" }, ], "php": [ { "begin": "/*", "end": "*/", }, { "begin": "[", "end": "]", }, { "begin": "{", "end": "}", }, ], "css": [ { "begin": "{", "end": "}" }, ], "scss": [ { "begin": "{", "end": "}" }, { "begin": "(", "end": ")" }, ], "html": [ { "beginRegex": "<[a-z]+(>|.*?[^/]>)", "endRegex": "<\/[a-z]+>", }, ], } } ```