Author Topic: Add code alignment options in v22?  (Read 252 times)

jwiede

  • Community Member
  • Posts: 82
  • Hero Points: 10
Add code alignment options in v22?
« on: September 22, 2017, 07:05:30 pm »
Any chance we can get functionality similar to what the "Code Alignment" plugin offers in v22?

davehohl

  • Senior Community Member
  • Posts: 246
  • Hero Points: 15
Re: Add code alignment options in v22?
« Reply #1 on: September 22, 2017, 07:32:26 pm »
Never knew about that plug-in before. Looks like a very handy tool. It would be great for SE to support this kind of functionality.

Graeme

  • Senior Community Member
  • Posts: 1980
  • Hero Points: 226
Re: Add code alignment options in v22?
« Reply #2 on: September 22, 2017, 11:48:25 pm »
Can you give an example of what this does and what it's useful for?


LBCEi

  • Senior Community Member
  • Posts: 158
  • Hero Points: 9
Re: Add code alignment options in v22?
« Reply #3 on: September 23, 2017, 03:59:10 am »
Try this user contributed set of macros for a partial implementation of code alignment and a couple of other features that I use all the time in SE:

https://community.slickedit.com/index.php/topic,5899.msg24394.html#msg24394

It probably wouldn't be too hard to modify the aligneq macro to align on other tokens besides '=', if you so desire.

davehohl

  • Senior Community Member
  • Posts: 246
  • Hero Points: 15
Re: Add code alignment options in v22?
« Reply #4 on: September 25, 2017, 04:45:07 pm »
Can you give an example of what this does and what it's useful for?

See attached screenshot from Code Alignment web site:


jporkkahtc

  • Senior Community Member
  • Posts: 1407
  • Hero Points: 107
  • Text
Re: Add code alignment options in v22?
« Reply #5 on: September 25, 2017, 07:33:53 pm »
This is the same thing as Elastic-Tabstops, right?
Seems to be gaining a bit of traction.
It would be nice if you can get it right and avoid conflicting with things like beautify while typing.

https://community.slickedit.com/index.php/topic,14239.msg58881.html#msg58881
https://community.slickedit.com/index.php/topic,14650.msg52909.html#msg52909
http://nickgravgaard.com/elastic-tabstops/


davehohl

  • Senior Community Member
  • Posts: 246
  • Hero Points: 15
Re: Add code alignment options in v22?
« Reply #6 on: September 25, 2017, 08:36:48 pm »
This is the same thing as Elastic-Tabstops, right?
Seems to be gaining a bit of traction.
It would be nice if you can get it right and avoid conflicting with things like beautify while typing.

https://community.slickedit.com/index.php/topic,14239.msg58881.html#msg58881
https://community.slickedit.com/index.php/topic,14650.msg52909.html#msg52909
http://nickgravgaard.com/elastic-tabstops/

Thanks for the links! Looks like the elastic tabstops is a more sophisticated approach to the issue, but is certainly addressing the same basic problem. Elastic tabstops would be awesome, but I would be happy with just the ability to select some text and have things get aligned by adding spaces. (I need to check out that macro that LBCEi mentioned.)

davehohl

  • Senior Community Member
  • Posts: 246
  • Hero Points: 15
Re: Add code alignment options in v22?
« Reply #7 on: September 27, 2017, 04:12:44 pm »
Try this user contributed set of macros for a partial implementation of code alignment and a couple of other features that I use all the time in SE:

https://community.slickedit.com/index.php/topic,5899.msg24394.html#msg24394

It probably wouldn't be too hard to modify the aligneq macro to align on other tokens besides '=', if you so desire.

OK, I took up LBCEi's challenge and modified the original to add a new command -- align-custom -- which prompts the user for a string to align on. I have attached the macro file in case others are interested. Not as powerful as the elastic tabstops feature would be, but still pretty useful.

This is my first attempt at working with Slick-C, so the macro comes with no guarantees!