[TxMt] Re: Spelling in comments

Eric Uner eric at uner.com
Tue Aug 12 03:23:06 UTC 2008


> On 8 Aug 2008, at 18:44, Mikael H?ilund wrote:
>
>> Personally, I use the convention of "#" to start a code comment, and
>> "# " to start a text comment. I'm not sure if it's possible to modify
>> the Ruby grammar to allow only spell checking for only lines with "#
>> ", nor how difficult that would be.
>
> It?s fairly simple. There is a rule to match comments, just duplicate
> it to match your commetns+space (place it above, so it gets to match
> first, since it is a subset of the existing).
>
> Give that a special scope, like comment.line.prose and make a spell
> checking preference target that scope.

Sorry to be such a n00b at this, but I am at my wit's end trying to do  
this for C++ and I appreciate use any help anyone has to offer.

Say, for example, I want to enable spell-check in comments that start  
with "//"

There is a pattern for that style of comment in the Bundle for C->C

{ scopeName = 'source.c';
...
		{	name = 'comment.line.double-slash.c++';
...

So I thought perhaps I could add a preference containing  
"{ spellChecking = 1; }" with Scope Selector "source.c", and that  
would enable spell checking on all C source. Then I was thinking scope  
naming might extend into the "name", so that I could set the Scope  
Selector to "source.c.comment.line.double-slash.c++".

None of that worked, no matter if I added the preference in the C  
section or the Source section or above or below any other preferences.

Basically, the only thing I was successful in doing was setting  
"spellChecking = 1;" in Source-> Spell Checking: Disable for Source  
bundle, but that enables spell checking for all source, and not just  
for the comments (i.e. all code in all languages).

Can someone point me to a relevant example or some resources that  
might help? I feel like I am missing some simple, obvious, but clearly  
essential step.

Thanks,

Doc



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2409 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20080811/b803e4e4/attachment.p7s>


More information about the textmate mailing list