maptz.vscode.extensions.customfolding icon indicating copy to clipboard operation
maptz.vscode.extensions.customfolding copied to clipboard

Some language services prevent `vscode.FoldingRangeProvider` from working correctly

Open maptz opened this issue 4 years ago • 6 comments

There is a known issue that a custom vscode.FoldingRangeProvider does not work correctly with some language services. A custom FoldingRangeProvider either prevents the default language folding to appear (C/C++), or prevents customization (Python)

This issue currently affects

  • Lua
  • Python
  • C/C++

maptz avatar Feb 04 '20 05:02 maptz

The issue is that the normal indentRangeProvider functionality is no longer provided when a RangeProvider is supplied.

As far as I see it, the only option is to implement the indentRangeProvide in custom code.

The implementation is available here, https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/folding/indentRangeProvider.ts

But it's not trivial to adapt it to an extension as it relies on a long import chain.

maptz avatar Feb 04 '20 09:02 maptz

Is this issue being fixed? The bug is a show-stopper, i cannot use this extension if it breaks my other code folds and i cant find any references how to implement the indendRangeProvide linked above.

Any hints would be GREATLY appreciated!

Liggist avatar May 10 '20 09:05 Liggist

Unfortunately not. I've been speaking to the VS Code team and it's definitely because of the way the folding providers are implemented. We can't see a way to fix it until the VS Code codebase changes. A pull request should have been made ok the VS Code repo though - but they haven't confirmed this yet.

maptz avatar May 10 '20 10:05 maptz

With this vscode version

Version: 1.53.2
Commit: 622cb03f7e070a9670c94bae1a45d78d7181fbd4
Date: 2021-02-11T11:45:54.515Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Darwin x64 19.6.0

and latest extension, python files have no folding, as opposed to previous statement of "no customisation". Changing the file type to plain text makes the folding appear again, as well as they are visible for a brief moment after opening a .py file or switching types (assumedly until this extension loads). I am disabling python in extension settings for now, as I don't extensively use vscode for python

Kyle-sandeman-mrdfood avatar Feb 23 '21 14:02 Kyle-sandeman-mrdfood

I am uninstalling the extension as folding has stopped working for YAML, which is the other significant file type after python that I use. The extension is a good idea but not worth using until the extension and/or vs code itself are fixed

Kyle-sandeman-mrdfood avatar Apr 08 '21 10:04 Kyle-sandeman-mrdfood

Update. This requires changes to VS Code under the hood. I'm short of time and so looking into this issue is hard for me to prioritize at the moment outside my day job.

Can I get a general sense of how much this is impacting people?

maptz avatar Nov 09 '21 23:11 maptz

Can I get a general sense of how much this is impacting people?

Not sure why GitHub isn't showing me the normal upvote/emoji button, but big upvote from me

strider72 avatar Jan 18 '23 08:01 strider72

This looks like this has now been fixed.

maptz avatar Mar 12 '23 21:03 maptz

I still occur bug with php language. So how to fix it? image

giapdong avatar Mar 14 '23 06:03 giapdong

I Just updated to Visual Code V.1.77.3, and I also updated this plugin, it's now at V.1.0.22

Still the bug persists for PHP. I use intelliphense, I don't know if it plays any role.

The deal is as soon as I disable the plugin, folding comes back :(

alexNecroJack avatar Apr 25 '23 19:04 alexNecroJack

Yes, I confirm. Even disabling folding for the language does nothing. Only setting [php]: {"editor.defaultFoldingRangeProvider": "bmewburn.vscode-intelephense-client"} does the job, which is, in effect, disables this extension for the language. Even when disabled with "disableFolding": true, for the language, PHP folding does not come back...

Currently this plugin is unusable due to this :( I wander, is there any update on this? From you or the V.C. team?

alexNecroJack avatar Apr 25 '23 20:04 alexNecroJack

I can also confirm this issue using C and the MS C/C++ Tools. Interestingly, the issue disappears when using mohammadbaqer.better-folding in conjunction with this extension.

Janfel avatar Jun 24 '23 20:06 Janfel

@Janfel love you man! You made my day! I was laughing for too much time out of joy when seeing this plugin!!! Thank you for sharing, you are my hero :D haha

alexNecroJack avatar Jul 25 '23 20:07 alexNecroJack