[TxMt] Insert Command Header

Emmanuel Turquin emmanuel at turquin.org
Tue Oct 31 17:56:55 UTC 2006


Allan Odgaard a écrit :
> On 31. Oct 2006, at 16:39, Emmanuel Turquin wrote:
>
>> The 'Insert Command Header' snippet in the 'source' bundle has '//' 
>> hardcoded as the start comment token. Wouldn't it make more sense to 
>> turn it into a command that would take each language comment 
>> delimiters into account?
>
> Yes, except that some languages/users have block comment characters 
> set as the default.
>
> So if it should be changed, it would need to be a command that scanned 
> through the array of comment delimiters, and found the first single 
> line comment character.

Or use block comments in case the language doesn't allow anything else. 
I first tried to write it as a snippet, which ended looking very much 
like a command masqueraded as a snippet (but maybe isn't it that bad on 
Halloween day :).
In case of single line comments, there's not special issue, and in case 
of block comments, what i was doing was filling each beginning of line 
with the last character of the COMMENT_START token, times its length. At 
least it seemed to make sense for the languages I had in mind.




More information about the textmate mailing list