merge mads379/align.tmbundle into source:Align Assignments command

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

merge mads379/align.tmbundle into source:Align Assignments command

Timothy Bates
It would be nice if the Align Assignments command absorbed the smart code from the align bundle, which appears moribund (?), but which is much smarter about alignments.

https://github.com/mads379/align.tmbundle

_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: merge mads379/align.tmbundle into source:Align Assignments command

Allan Odgaard-4

On 14 Nov 2018, at 19:07, Tim Bates wrote:

It would be nice if the Align Assignments command absorbed the smart code from the align bundle, which appears moribund (?), but which is much smarter about alignments.

I’m not keen on switching to a preferneces based system because majority of users will not want to customize the Align Assignments command, and I am also not sure what cases (handled by the default command) where the user would actually want to change it.

But it would be useful to know where the current command gets it wrong or how it can be improved.



_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: merge mads379/align.tmbundle into source:Align Assignments command

Timothy Bates
> On 14 Nov 2018, at 19:07, Tim Bates wrote:
>> It would be nice if the Align Assignments command absorbed the smart code from the align bundle, which appears moribund (?), but which is much smarter about alignments.

> On 14 Nov 2018, at 12:34 pm, Allan Odgaard <[hidden email]> wrote:
> I’m not keen on switching to a preferneces based system because majority of users will not want to customize the Align Assignments command, and I am also not sure what cases (handled by the default command) where the user would actually want to change it.
> But it would be useful to know where the current command gets it wrong or how it can be improved.

For one, given this selection in an R script:

#' selDVs = c("ht1", "ht2")
#' mzData     <- twinData[twinData$zygosity %in% "MZFF", ]
#' dzData <- twinData[twinData$zygosity %in% "DZFF", ]


align does the right thing, and aligns the <- assignments. The built-in align does nothing. So having the built-in do the right thing here would be good.


The preferences system could be independent of user intervention, no? Just get bundle maintainers to include an align preference. Like this one for R
And the ready-made align command in TM could inherit/import these.


{ shellVariables = (
                { name = 'TM_SOURCE_ALIGNMENT_PATTERN';
                        value = '[
      {
        "comment" : "align on assignments",
        "regexp" : "=|<-|->",
        "minimum_spacing_before" : " ",
        "minimum_spacing_after" : " ",
        "padding" : "before"
      },
      {
        "comment" : "align right-hand side formulae assignments",
        "regexp" : "~",
        "minimum_spacing_before" : " ",
        "minimum_spacing_after" : " ",
        "padding" : "before"
      },
      {
        "comment" : "align any stacked assignments on a line",
        "regexp" : ";",
        "minimum_spacing_before" : "",
        "minimum_spacing_after" : " ",
        "padding" : "before"
      },
      {
        "comment" : "align any comments",
        "regexp" : "#",
        "minimum_spacing_before" : " ",
        "minimum_spacing_after" : " ",
        "padding" : "before"
      }]';
                },
        );
}

_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: merge mads379/align.tmbundle into source:Align Assignments command

Allan Odgaard-4

On 15 Nov 2018, at 0:43, Tim Bates wrote:

For one, given this selection in an R script:

#' selDVs = c("ht1", "ht2")
#' mzData <- twinData[twinData$zygosity %in% "MZFF", ]
#' dzData <- twinData[twinData$zygosity %in% "DZFF", ]

Do you use <- interchangeably with =? So the desired result is:

#' selDVs  = c("ht1", "ht2")
#' mzData <- twinData[twinData$zygosity %in% "MZFF", ]
#' dzData <- twinData[twinData$zygosity %in% "DZFF", ]

align does the right thing, and aligns the <- assignments. The built-in align does nothing. So having the built-in do the right thing here would be good.

I see no issue with adding <- to the list of operators on line 9 of Align Assignments.

The preferences system could be independent of user intervention, no? Just get bundle maintainers to include an align preference. Like this one for R
And the ready-made align command in TM could inherit/import these.

Since 99% of languages have the same assignment operators, it seems awfully redundant, and a heuristic might be smarter than a preference system.

For example currently, the command will first check if there are equal characters, failing that, it will use colon.

I am thinking this could be made even smarter, so it would not just check if the characters exist, but it will check if they are already aligned, and if so, jump to the next character in the list, that way, you could use Align Assignments in successesion, e.g. first to align assignments, then press again to align the trailing line comments.



_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: merge mads379/align.tmbundle into source:Align Assignments command

Timothy Bates
Thanks twould be great: one often wants the command to look out into the line for something else to align once an initial assign is aligned. Like commas too.
T

On Thu, Nov 15, 2018, 1:22 AM Allan Odgaard <[hidden email]> wrote:

On 15 Nov 2018, at 0:43, Tim Bates wrote:

For one, given this selection in an R script:

#' selDVs = c("ht1", "ht2")
#' mzData <- twinData[twinData$zygosity %in% "MZFF", ]
#' dzData <- twinData[twinData$zygosity %in% "DZFF", ]

Do you use <- interchangeably with =? So the desired result is:

#' selDVs  = c("ht1", "ht2")
#' mzData <- twinData[twinData$zygosity %in% "MZFF", ]
#' dzData <- twinData[twinData$zygosity %in% "DZFF", ]

align does the right thing, and aligns the <- assignments. The built-in align does nothing. So having the built-in do the right thing here would be good.

I see no issue with adding <- to the list of operators on line 9 of Align Assignments.

The preferences system could be independent of user intervention, no? Just get bundle maintainers to include an align preference. Like this one for R
And the ready-made align command in TM could inherit/import these.

Since 99% of languages have the same assignment operators, it seems awfully redundant, and a heuristic might be smarter than a preference system.

For example currently, the command will first check if there are equal characters, failing that, it will use colon.

I am thinking this could be made even smarter, so it would not just check if the characters exist, but it will check if they are already aligned, and if so, jump to the next character in the list, that way, you could use Align Assignments in successesion, e.g. first to align assignments, then press again to align the trailing line comments.


_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: merge mads379/align.tmbundle into source:Align Assignments command

Allan Odgaard-4

On 18 Nov 2018, at 11:34, Timothy Bates wrote:

Thanks twould be great: one often wants the command to look out into the
line for something else to align once an initial assign is aligned. Like
commas too.

I didn’t get around to making it advance through the alignment operators, but I just pushed a version which includes <- as an alignment character, sorry for the wait.

I forget how much I wrote about my reworked Align Assignments, but it has really worked great for me, something I really love is the ability to detect indentation and keep the changes within the current level, for example with something like this:

while post = posts.shift
  title = post.title
  body = post.body
end

Using ⌥⌘] in the body will not be confused by the assignment on the first line.

Likewise for data structures we may have something like:

post: {
  title: "My title",
  body: "Some body"
}

Again, using ⌥⌘] in the middle works as expected :)



_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: merge mads379/align.tmbundle into source:Align Assignments command

Timothy Bates
Great! Thanks Allen!

On 1 Jul 2019, at 12:54 pm, Allan Odgaard <[hidden email]> wrote:

On 18 Nov 2018, at 11:34, Timothy Bates wrote:

Thanks twould be great: one often wants the command to look out into the
line for something else to align once an initial assign is aligned. Like
commas too.

I didn’t get around to making it advance through the alignment operators, but I just pushed a version which includes <- as an alignment character, sorry for the wait.

I forget how much I wrote about my reworked Align Assignments, but it has really worked great for me, something I really love is the ability to detect indentation and keep the changes within the current level, for example with something like this:

while post = posts.shift
  title = post.title
  body = post.body
end

Using ⌥⌘] in the body will not be confused by the assignment on the first line.

Likewise for data structures we may have something like:

post: {
  title: "My title",
  body: "Some body"
}

Again, using ⌥⌘] in the middle works as expected :)


_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate



_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

touch bar operational?

Timothy Bates
We’ve seen some changes related to the touch bar API in changes. But the "View: Customise Touch Bar” menu item is greyed out and touch bar is just function keys - is there a way to make t-bar edits? or do this from a bundle?

t

_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: touch bar operational?

Ronald Wampler
On Thu, Jul 11, 2019 at 3:38 PM Timothy Bates <[hidden email]> wrote:
>
> We’ve seen some changes related to the touch bar API in changes. But the "View: Customise Touch Bar” menu item is greyed out and touch bar is just function keys - is there a way to make t-bar edits? or do this from a bundle?
Check to see if TextMate is added to only show the function keys
(System Preferences>Keyboard>Shortcuts>Function Keys).
>
> t
>
> _______________________________________________
> textmate mailing list
> [hidden email]
> https://lists.macromates.com/listinfo/textmate

_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: touch bar operational?

Timothy Bates
Bingo!
Thanks: adding a note about that in TM prefs would be good, or perhaps make the action of the view:customize touch bar menu item be to open that pane if it would otherwise be disabled?

> On 12 Jul 2019, at 15:37, Ronald Wampler <[hidden email]> wrote:
>
> On Thu, Jul 11, 2019 at 3:38 PM Timothy Bates <[hidden email]> wrote:
>>
>> We’ve seen some changes related to the touch bar API in changes. But the "View: Customise Touch Bar” menu item is greyed out and touch bar is just function keys - is there a way to make t-bar edits? or do this from a bundle?
> Check to see if TextMate is added to only show the function keys
> (System Preferences>Keyboard>Shortcuts>Function Keys).
>>
>> t
>>
>> _______________________________________________
>> textmate mailing list
>> [hidden email]
>> https://lists.macromates.com/listinfo/textmate
>
> _______________________________________________
> textmate mailing list
> [hidden email]
> https://lists.macromates.com/listinfo/textmate


_______________________________________________
textmate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate