Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

blob view code folding#47266

Merged
taras-yemets merged 9 commits into
mainfrom
taras-yemets/indent-based-code-folding
Feb 3, 2023
Merged

blob view code folding#47266
taras-yemets merged 9 commits into
mainfrom
taras-yemets/indent-based-code-folding

Conversation

@taras-yemets

@taras-yemets taras-yemets commented Feb 1, 2023

Copy link
Copy Markdown
Contributor

Adds indent-based VSCode-like code folding.

Screen.Recording.2023-02-01.at.17.24.00.mov

Test plan

Tested manually (video attached).

App preview:

Check out the client app preview documentation to learn more.

@cla-bot cla-bot Bot added the cla-signed label Feb 1, 2023
@sg-e2e-regression-test-bob

sg-e2e-regression-test-bob commented Feb 1, 2023

Copy link
Copy Markdown

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) 0.02% (+2.73 kb) 0.02% (+2.73 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits 4b95951 and 7e7805d or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@taras-yemets taras-yemets requested a review from a team February 1, 2023 15:25
@taras-yemets taras-yemets marked this pull request as ready for review February 1, 2023 15:25
@olafurpg

olafurpg commented Feb 1, 2023

Copy link
Copy Markdown
Contributor

Is it possible to fold with keyboard shortcuts based on the current selection?

@olafurpg

olafurpg commented Feb 1, 2023

Copy link
Copy Markdown
Contributor

Another Q: how does moving the selection interact with folded ranges? IntelliJ folding has always felt a lot more intuitive and useful than VS Code folding because it moves the cursor over folded regions while VS Code expands the folded range when the cursor moves into it. A very common situation where I like using folding is to fold the current method/class and then move down to reach the next method/class.

@taras-yemets

Copy link
Copy Markdown
Contributor Author

Is it possible to fold with keyboard shortcuts based on the current selection?

@olafurpg, added folding keybindings support in https://github.com/sourcegraph/sourcegraph/pull/47266/commits/712beee713976caf230b4745e5a3c87dde4afa11.

The only issue with it is that the foldAll command currently blurs the selected. Fixing it 👨🏻‍💻

@taras-yemets

Copy link
Copy Markdown
Contributor Author

Another Q: how does moving the selection interact with folded ranges? IntelliJ folding has always felt a lot more intuitive and useful than VS Code folding because it moves the cursor over folded regions while VS Code expands the folded range when the cursor moves into it. A very common situation where I like using folding is to fold the current method/class and then move down to reach the next method/class.

@olafurpg, the current behavior is VSCode-like: it expands the folding when cursor moves inside.

@olafurpg

olafurpg commented Feb 1, 2023

Copy link
Copy Markdown
Contributor

the current behavior is VSCode-like: it expands the folding when cursor moves inside.

Not a blocking issue for this PR, but could we get the IntelliJ behavior where it skips the folded range? As long as we know which ranges are folded then we could update the arrow keybindings to skip those ranges.

@philipp-spiess philipp-spiess left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesomesauce!

Comment thread client/web/src/repo/blob/codemirror/code-folding.tsx Outdated
@taras-yemets taras-yemets merged commit 0f7f0af into main Feb 3, 2023
@taras-yemets taras-yemets deleted the taras-yemets/indent-based-code-folding branch February 3, 2023 10:02
@taras-yemets taras-yemets mentioned this pull request Mar 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants