I'm working on a command to reflow perl/shell style # comments and running into a problem with scopes.
When I do a 'select scope' with the mouse on a comment, it correctly selects the surrounding lines beginning with #. However, if I set up a simple 'cat' command (seen here: http://grab.by/WGt) with the input set to "Selected Text or Scope" and the output set to tooltip, the tooltip is displaying the entire contents of the file (seen here: http://grab.by/WHB)
I'm running Version 1.5.8 (1509) on 10.6.2. What am I missing? Thanks!
Matt
Is it safe for me to assume this problem only affects me and no one has any thoughts? I'd really like to get this working, but the scope doesn't appear to be working. Thanks!
On Dec 2, 2009, at 8:42 PM, Matt Cable wrote:
I'm working on a command to reflow perl/shell style # comments and running into a problem with scopes.
When I do a 'select scope' with the mouse on a comment, it correctly selects the surrounding lines beginning with #. However, if I set up a simple 'cat' command (seen here: http://grab.by/WGt) with the input set to "Selected Text or Scope" and the output set to tooltip, the tooltip is displaying the entire contents of the file (seen here: http://grab.by/WHB)
I'm running Version 1.5.8 (1509) on 10.6.2. What am I missing? Thanks!
Matt
Hi Matt,
well, unfortunately this also doesn't work for me [ TM 1.5.9 (1589) MacOSX 10.6.2]. I think the fallback to "Scope" is broken. One quick%dirty workaround is to write your command and set the input of Selection and maybe output to Replace Selection; then record a macro: - Edit > Select > Current Scope (^⌥B) - call your_command
and save it.
An other option would be to add to your_command.plist this: <key>inputFormat</key> <string>xml</string>
Then you'll get a tagged xml output with all scopes which can be parsed.
Maybe Allan has an idea why it doesn't work anymore.
--Hans
Glad I'm not crazy ;)
Thanks for the advice. I'll give that a try.
On Dec 5, 2009, at 5:41 AM, Hans-Jörg Bibiko wrote:
Hi Matt,
well, unfortunately this also doesn't work for me [ TM 1.5.9 (1589) MacOSX 10.6.2]. I think the fallback to "Scope" is broken. One quick%dirty workaround is to write your command and set the input of Selection and maybe output to Replace Selection; then record a macro:
- Edit > Select > Current Scope (^⌥B)
- call your_command
and save it.
An other option would be to add to your_command.plist this: <key>inputFormat</key> <string>xml</string>
Then you'll get a tagged xml output with all scopes which can be parsed.
Maybe Allan has an idea why it doesn't work anymore.
--Hans
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On Dec 5, 2009, at 6:41 AM, Hans-Jörg Bibiko wrote:
well, unfortunately this also doesn't work for me [ TM 1.5.9 (1589) MacOSX 10.6.2]. I think the fallback to "Scope" is broken. One quick%dirty workaround is to write your command and set the input of Selection and maybe output to Replace Selection; then record a macro:
This is working fine for me in 1589, can you send me your broken command Hans?
On Dec 7, 2009, at 7:12 AM, Michael Sheets wrote:
On Dec 5, 2009, at 6:41 AM, Hans-Jörg Bibiko wrote:
well, unfortunately this also doesn't work for me [ TM 1.5.9 (1589) MacOSX 10.6.2]. I think the fallback to "Scope" is broken. One quick%dirty workaround is to write your command and set the input of Selection and maybe output to Replace Selection; then record a macro:
This is working fine for me in 1589, can you send me your broken command Hans?
Hi Michael,
I fiddled around with this topic, and it's in some sense mystically.
I have two Macs a MacBook and a Mac Pro running the same TM, OS version T 1.5.9 (1589) and Mac OSX 10.6.2; and I have a bundle command:
Input: Selection or Scope Output: Show Tool Tip Command: cat
bound to: ^1
On my MacBook if I'm inside of a multi-line comment the output is correct. The same file on my Mac Pro, same caret location in a multi-line comment I do see the entire document.
If I place the caret to a function word e.g.: -on MacBook the output is empty -on Mac Pro I do see the entire document again
If invoke ^⌥B for Select current Scope on both machines it works always perfectly.
The only difference of both Macs is that I installed a fresh Snow Leopard OS on an empty hard disk, whereby on my MacBook I upgraded Leopard to Snow Leopard.
I have no idea what's going on here.
Cheers, --Hans
On Dec 7, 2009, at 2:11 AM, Hans-Jörg Bibiko wrote:
I fiddled around with this topic, and it's in some sense mystically.
I have two Macs a MacBook and a Mac Pro running the same TM, OS version T 1.5.9 (1589) and Mac OSX 10.6.2; and I have a bundle command:
What is the scope selector of this command? You mention using it outside of a comment which wouldn't be possible with a proper scope.
On Dec 7, 2009, at 12:11 PM, Michael Sheets wrote:
On Dec 7, 2009, at 2:11 AM, Hans-Jörg Bibiko wrote:
I fiddled around with this topic, and it's in some sense mystically.
I have two Macs a MacBook and a Mac Pro running the same TM, OS version T 1.5.9 (1589) and Mac OSX 10.6.2; and I have a bundle command:
What is the scope selector of this command? You mention using it outside of a comment which wouldn't be possible with a proper scope.
Oh my goodness, I didn't see the forest for trees. Of course, the scope selector!!
If I add to my command the Scope Selectors which should match like: "comment, variable"
it works of course.
Sometimes I feel like a raw recruit ;) esp. if one missed to read TextMate's manual chapter 10.1 Command Input carefully: ... One fallback unit which requires a little explanation is Scope. When the input is set to this, TextMate will search backwards and forwards for the first character ***which is not matched by the scope selector of the command*** and use those as boundaries for the input.
This means that if the language grammar marks up URLs and gives these a scope of markup.underline.url then a ***command with that as the scope selector*** can set its input to Selection or Scope and will thus get the URL as input, when this command is executed with the caret on an URL.
Sorry for the confusion :)
Best, --Hans
PS The mystic thing I spoke about also is solved. I copied my test command to the other machine without executing "Reload Bundles" :/ and my "old" command had the scope selector "comment".
On Dec 2, 2009, at 8:42 PM, Matt Cable wrote:
When I do a 'select scope' with the mouse on a comment, it correctly selects the surrounding lines beginning with #. However, if I set up a simple 'cat' command (seen here: http://grab.by/WGt) with the input set to "Selected Text or Scope" and the output set to tooltip, the tooltip is displaying the entire contents of the file (seen here: http://grab.by/WHB)
The “Generate Password” command in the LDIF bundle has the same things listed for input and is working, however, it doesn’t read from STDIN. Instead it acts on the value of TM_CURRENT_WORD. That variable is apparently replaced with the correct thing because the command works.
Does that make sense? Not necessarily. Is it *supposed* to work? I don’t know… but it’s working for now.
Perhaps instead of `cat`-ing STDIN, you can `echo` the values of various TM_ variables and see if any of them consistently and reliably contain the text you’re looking for.