microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.38k stars 29.32k forks source link

folding indicators in sticky scroll are off if fontSize is set #224458

Open minimote opened 3 months ago

minimote commented 3 months ago

Type: Bug

% ------------------------------------------ % LaTeX Code % region A % region B % region C

% There are many lines of code here

% endregion C % endregion B % endregion A % ------------------------------------------

When we swipe down, regionA, B, and C will all appear at the top of the page. When we click the fold button on the left side of regionC, what is actually folded is its previous level regionB. When we click the fold button on the left side of regionB, what is folded is its previous level regionA. The correct logic should be: which region's fold button is clicked, the region of that level should be folded. When all rows within the region can appear on the screen, the folding function is correct.

当我们往下滑动时,regionA、B、C都会出现在页面顶部,当点击regionC左侧的折叠按钮时,实际折叠的却是它的上一级regionB,点击regionB左侧的折叠按钮时,折叠的是它的上一级regionA,正确的逻辑应该是:点击哪个region的折叠按钮,折叠的应该就是该级别的region。当region内部的所有行都能出现在屏幕里时,折叠功能是正确的。

VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:06:49.809Z) OS version: Windows_NT x64 10.0.22621 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2208)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|15.86GB (4.60GB free)| |Process Argv|--crash-reporter-id 863b8fda-295a-4b80-bc2d-0a787e1ce6e0| |Screen Reader|no| |VM|0%|
Extensions (25) Extension|Author (truncated)|Version ---|---|--- tongyi-lingma|Ali|1.3.6 vscode-markdownlint|Dav|0.55.0 prettier-vscode|esb|10.4.0 code-runner|for|0.12.2 latex-workshop|Jam|10.1.0 vsc-python-indent|Kev|1.18.0 rainbow-csv|mec|3.12.0 vscode-filesize|mkx|3.1.0 vscode-language-pack-zh-hans|MS-|1.91.2024071009 debugpy|ms-|2024.8.0 python|ms-|2024.12.1 vscode-pylance|ms-|2024.7.1 jupyter|ms-|2024.6.0 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.19 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 cpptools|ms-|1.21.5 korofileheader|OBK|4.9.3 markdown-preview-enhanced|shd|0.8.13 swdc-vscode|sof|2.7.14 latex-utilities|tec|0.4.14 vscode-counter|uct|3.4.0 local-history|xyz|1.8.1 markdown-pdf|yza|1.5.0
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 vscaac:30438847 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 bdiig495:31013172 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 newcmakeconfigv2:31071590 impr_priority:31102340 refactort:31101459 ccplt:31103426 pythonrstrctxtcf:31103194 hdi1a554:31097393 ```
aeschli commented 3 months ago

This is what I see when I click on the folding indicator before region C:

Image

That is the expected behavior, that matches how regions fold.

The region starts with the occurrence of % region C and ends after the next line with the occurrences of % endregion.

minimote commented 3 months ago

@aeschli

If the content of the innermost region is very short, so that the region and end region can be displayed on the same page, the result is the same as that shown in you. However, if the content of the innermost region is very large, for example, 20 lines or more, until the content exceeds the height of one screen, Then click the floating region folding button at the top, and the situation of folding the upper level will appear.

当最内层的region的内容很短,使得region和end region 可以出现在同一个页面中时,结果就和您展示的一样,但是如果最内层的region里面内容很多,例如有20行或者更多,直到超过一个屏幕的高度,那么此时点击顶部浮动的region折叠按钮就会出现折叠了上一级的情况。

initpintu_副本

aeschli commented 3 months ago

Ok, so I add many lines so I get the sticky scroll section to show and I click on line 10 (region B)

Image

Image

In your screenshot, the endregion B is not part of the folded content.

This is because you have the latex-workshop extension installed, which implements a different folding behavior.

But I can not see a bug with folding. I can not reproduce your finding: When we click the fold button on the left side of regionB, what is folded is its previous level regionA

minimote commented 3 months ago

@aeschli

I found a difference in our screenshot. My folding symbol only appears in the innermost folding, so when there are three layers of regions A, B, and C, I clicked on the innermost layer, which is the folding symbol of region C. At this time, the folding is indeed region B. This problem can still be repeated at present.

In addition, I tried to disable the LaTeX Workshop plugin and restart the software, and the problem still persists, so the problem should come from VSCode itself.

My current version of VSCode should be the latest version: 版本: 1.92.0 (system setup) 提交: b1c0a14de1414fcdaa400695b4db1c0799bc3124 日期: 2024-07-31T23:26:45.634Z Electron: 30.1.2 ElectronBuildId: 9870757 Chromium: 124.0.6367.243 Node.js: 20.14.0 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22621

https://github.com/user-attachments/assets/9730cd0b-4a61-48c9-93ed-966475a56a57

aeschli commented 3 months ago

I still can't reproduce. Can you provide the sample code that you have in the video. Maybe it's related to the other lines in the file? Can you find out if is related to settings? An easy way is to change to an empty profile.

minimote commented 3 months ago

@aeschli

After my checks, it was a setup problem. When I set editor.fontSize=19, all the fold symbols of the multi-level region are displayed, and the fold area is normal after clicking. When editor.fontSize=20 or above, only the fold symbol of the innermost region is displayed, and an exception occurs when the fold area is clicked.

https://github.com/user-attachments/assets/e0e152ab-ab55-430c-ae54-bbbd2e948a7e

The complete code I used in the video is as follows

%%
% Author       : GWL
% Date         : 2024-08-07 20:09:23
% LastEditors  : GWL
% LastEditTime : 2024-08-07 20:27:24
%%

% ------------------------------------------
% LaTeX Code
% region A

% region B

% region C

I found a difference in our screenshot. My folding symbol only appears in the innermost folding, so when there are three layers of regions A, B, and C, I clicked on the innermost layer, which is the folding symbol of region C. At this time, the folding is indeed region B. This problem can still be repeated at present.

In addition, I tried to disable the LaTeX Workshop plugin and restart the software, and the problem still persists, so the problem should come from VSCode itself.

My current version of VSCode should be the latest version: 
版本: 1.92.0 (system setup)
提交: b1c0a14de1414fcdaa400695b4db1c0799bc3124
日期: 2024-07-31T23:26:45.634Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22621

% There are many lines of code here

% endregion C

% endregion B
% endregion A
% ------------------------------------------
aeschli commented 3 months ago

@miniAtom Thanks a lot, that's a great find. It looks like the sticky scroll does not correctly apply the the fontSize property Assigning to @aiday-mar

minimote commented 3 months ago

@aeschli You're welcome. I have a small suggestion about this, and maybe I can ask you to help convey it to the relevant department.

The size of the folding symbol next to the code seems to be constant. When the font is large, the folding symbol looks very small and incongruous. Can we change the size of the folding symbol together with the font size?

aeschli commented 3 months ago

The size of the folding symbol next to the code seems to be constant. When the font is large, the folding symbol looks very small and incongruous. Can we change the size of the folding symbol together with the font size?

Can you file a separate feature request for that?

minimote commented 3 months ago

Can you file a separate feature request for that?

OK, thanks.