Skip to content

Conversation

@liltrendi
Copy link
Contributor

@liltrendi liltrendi commented May 23, 2025

Overview

Closes #110.

Normally, editors do support indentation based on where the cursor is positioned at:

  • If the cursor is at the start of the line, pressing TAB should add an indent from the beginning of the line
  • If the cursor is anywhere else within the line, pressing TAB should add an indent from the current cursor position
  • If there is a specific block of text highlighted, pressing TAB should add an indent relative to that text selection
  • SHIFT+TAB should do the inverse of all the operations mentioned above
  • Finally, selecting multiple lines and pressing either TAB or SHIFT+TAB, should work as explained above for the lines selected

This PR aims to implement this feature in a simple way.

Demo

Screen.Recording.2025-05-24.at.17.50.50.mov

@liltrendi

This comment was marked as resolved.

Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

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

I'm unfortunately not sure if we can merge this in the current state. I apologize for that. 🙈

Aside from the issues I mentioned, I believe this needs some polishing, because it's currently significantly larger than it likely could be. I have a strong gut feeling that the feature can be implemented in around 100 lines of code with a general approach that's similar to the existing code.

@liltrendi liltrendi requested a review from lhecker May 24, 2025 13:34
@liltrendi liltrendi changed the title Feature: Support Indentation On Highlighted & Unhighlighted Text With Tab Press [feat]: Support Indentation On Highlighted & Unhighlighted Text With Tab Press May 25, 2025
@liltrendi liltrendi changed the title [feat]: Support Indentation On Highlighted & Unhighlighted Text With Tab Press [feat]: support for single and multi line indentation May 25, 2025
Copy link

@AmirTallap AmirTallap left a comment

Choose a reason for hiding this comment

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

Well done, thanks!

@liltrendi
Copy link
Contributor Author

I'm unfortunately not sure if we can merge this in the current state. I apologize for that. 🙈

Aside from the issues I mentioned, I believe this needs some polishing, because it's currently significantly larger than it likely could be. I have a strong gut feeling that the feature can be implemented in around 100 lines of code with a general approach that's similar to the existing code.

Please have a look; refactored the implementation with a leaner approach & added multi-line support. Thanks!

@lhecker
Copy link
Member

lhecker commented May 27, 2025

I'll review it again once I get a chance. 🙂

@liltrendi liltrendi requested a review from AmirTallap June 5, 2025 01:37
@liltrendi
Copy link
Contributor Author

@DHowett requesting extra eyes on this 👀 would be nice early on so as to alleviate frequent conflicts.

@lhecker
Copy link
Member

lhecker commented Jun 19, 2025

I'll go through this PR after #397 merges, as it introduces the ability to group multiple changes into a single undo. This will be very useful for this PR as well.

@lhecker lhecker changed the title [feat]: support for single and multi line indentation Support for multiline indentation Jun 23, 2025
@lhecker lhecker enabled auto-merge (squash) June 23, 2025 16:05
@lhecker lhecker requested review from DHowett and removed request for AmirTallap June 23, 2025 16:05
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

thanks so much both of you for doing this!

@liltrendi
Copy link
Contributor Author

LFG 🚀 thanks @lhecker @DHowett

@lhecker lhecker merged commit b4cd1f6 into microsoft:main Jun 24, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tab should indent highlighted text or move it to the left!

4 participants