[SVN] Request for additional input types

Brad Choate brad at bradchoate.com
Fri Feb 10 21:24:46 UTC 2006


On Feb 10, 2006, at 12:59 PM, Allan Odgaard wrote:

> On 10/2/2006, at 20:59, Brad Choate wrote:
>
>> [...] What I would like is an "Input" choice on the bundle command  
>> dialog of "Current Paragraph". So I could say Input:  Selected  
>> Text or Current Paragraph. [...]
>>
>> Another input type I would love to see is "Scoped Text" [...]
>
> hmm… I sent you a private reply not so long ago which amongst  
> others said (the first one should allow for grabbing “current  
> paragraph”):

Well, you also asked me to post feature requests like this to a more  
public list so others could see the ensuing discourse.  And this  
current command I'm working on begs for it.


>     As for input choice, I would like to allow for a search
>     back/forward regexp to denote what should be the input, I think
>     this would be extremely flexible.

True-- and I'm not scared of regex, but simple things like "Current  
Line" are there and I assume would not be going away with a regex  
selection option.  "Current Paragraph" would be an easy way to ask  
for the current paragraph without having to fashion a regex pattern  
that accomodates different line endings and such.


>     As for the current scope as input: the problem is that e.g. for a
>     string, we markup escape sequences (and sometimes
>     printf-sequences), for URLs we may do similar down the read (e.g.
>     URL-quoted characters, markup the username/password part etc.),
>     which means if the caret is on one of these sub-parts, the
>     TM_SCOPE_TEXT would be wrong (as it would only be the escaped
>     character or similar).

I'm suggesting that the TM_SCOPE_TEXT be set to whatever is in scope  
according to the scope selector of the bundle command.  For example,  
if the bundle command's scope selector is:  string.quoted, then it  
would capture the whole quoted string.

For example, here we have a string in Ruby:

     x = "testing #{embedded} 1, 2, 3..."

Now, if I put my cursor within the string, the scope is "source.ruby"  
and "string.quoted.double.ruby".  If I create a command that is for  
"string.quoted" (or maybe the "Scoped Text" input choice lets me  
specify the scope I specifically want to capture...), then  
TM_SCOPE_TEXT would be assigned:

	"testing #{embedded} 1, 2, 3..."

It would knows to include the embedded portion because even if I put  
my cursor within the embedded escape, the scope is:  source.ruby  
string.quoted.double.ruby source.ruby.embedded.source.  So I think TM  
could be smart enough to combine text before and after the cursor to  
select everything that has a valid "string.quoted" scope and assign  
that to TM_SCOPE_TEXT (or send it as stdin, I don't care-- it may be  
a lot of content).

-Brad




More information about the textmate-dev mailing list