Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request :: Right-align cursors/selections #12

Open
whatsupbros opened this issue Dec 18, 2023 · 1 comment
Open

Feature request :: Right-align cursors/selections #12

whatsupbros opened this issue Dec 18, 2023 · 1 comment

Comments

@whatsupbros
Copy link

whatsupbros commented Dec 18, 2023

A feature to right-align all cursors/selections by adding necessary white space from the left would be really nice.

This is useful when you have several "parts" in your statement, and need to align those parts between each other, in example, SELECT/FROM/WHERE/GROUP BY/ORDER BY parts in SQL queries.

Example

Original text

She loves pie.
My friend loves chocolate cake.
Everybody loves muffins.

Left-aligned at the second word (current functionality)

She       loves pie.
My friend loves chocolate cake.
Nobody    loves muffins.

Right-aligned at the second word (desired functionality)

      She loves pie.
My friend loves chocolate cake.
   Nobody loves muffins.

Real world usage example in SQL query

SELECT t1.field1,
       t2.field2,
       t2.field3
  FROM table1 t1,
       table2 t2
 WHERE t1.field1 = t2.field1
   AND t2.field2 = 'ABC'
   AND EXISTS ( SELECT NULL
                  FROM table3 t3
                 WHERE t3.field1 = t1.field1
                   AND t3.field2 = 123 )

As shown here, SELECT, FROM, WHERE, AND are right-aligned, which is required in some projects.

@yo1dog
Copy link
Owner

yo1dog commented Aug 30, 2024

Can you give me some more details on how exactly you would expect this to work? I am having trouble understanding right-alignment in left-aligned environments.

How would the extension know where to insert the whitespace?

For example, what should happen in the following to "right-align" to words "love"? A or B? And how would the extension know?

Perhaps this would only be possible with selections which would define the bounds of the text to be right aligned. Outcome B would be possible if the user selected "She", "My Friend", and "Nobody".

var i = 0; // She loves pie.
fu();      // My friend loves chocolate cake.
bar();     // Nobody loves muffins.

A. Start of line.
      var i = 0; // She loves pie.
fu();      // My friend loves chocolate cake.
   bar();     // Nobody loves muffins.

B. ???
var i = 0; //       She loves pie.
fu();      // My friend loves chocolate cake.
bar();     //    Nobody loves muffins.

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

No branches or pull requests

2 participants