In looking at how spell checking in comments works, and searching the archives for alternatives and suggestions, I can see spelling is disabled in comments because, as Alan points out, "a lot of comments are actually commented out code." Good point, and I can clearly see there is no one way that can make everyone happy.
In my case, a tremendous amount of useful documentation is in code comments, and spelling errors make the code less professional. I am constantly going to an external editor, or typing the comment into a blank area of the document inside a quote so that TextMate thinks it is a string, then removing the quote and hitting command+/. I'm thinking about crating a shell script or bundle or something to do all this.
Does anyone have any more "elegant" suggestions?
It would be great if there was a way, for example, to have a menu item (perhaps even a bundle) that could just spell check the selection regardless of the context.
Thank you for any suggestions.
Doc
You can change the "Spell Checking: Disable for Source" value to 1 in the Source bundle to turn spellchecking on for comments. Click on 'Bundles->Bundle Editor->SHow Bundle Editor' and highlight the Source bundle in the list - the one you need is a preferences option in this bundle.
I've tested this with comments in PHP and it picks them up if the value is set to '1' but doesn't when set to '0'.
Nigel
On 8 Aug 2008, at 14:28, Eric Uner wrote:
In looking at how spell checking in comments works, and searching the archives for alternatives and suggestions, I can see spelling is disabled in comments because, as Alan points out, "a lot of comments are actually commented out code." Good point, and I can clearly see there is no one way that can make everyone happy.
In my case, a tremendous amount of useful documentation is in code comments, and spelling errors make the code less professional. I am constantly going to an external editor, or typing the comment into a blank area of the document inside a quote so that TextMate thinks it is a string, then removing the quote and hitting command+/. I'm thinking about crating a shell script or bundle or something to do all this.
Does anyone have any more "elegant" suggestions?
It would be great if there was a way, for example, to have a menu item (perhaps even a bundle) that could just spell check the selection regardless of the context.
Thank you for any suggestions.
Doc
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
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.
On 2008-Aug-8, at 12:44 PM, Mikael Høilund wrote:
Personally, I use the convention of "#" to start a code comment, and "# " to start a text comment.
I do something similar in PHP:
// a human-readable comment # disabled code
That way, after everything's working, I can run a command that removes all commented code, while leaving the actual comments intact.
Anyway, I'm curious about what you're doing since I've been doing more Python and // isn't available there. Don't you have a lot of code that's indented and would therefore start with "# " when you comment it out? How do you distinguish that from a textual comment?
Aw, don't tell me you're one of those people that uses tabs to indent. :)
--- Rob McBroom http://www.skurfer.com/
On Aug 8, 2008, at 7:26 PM, Rob McBroom wrote:
On 2008-Aug-8, at 12:44 PM, Mikael Høilund wrote:
Personally, I use the convention of "#" to start a code comment, and "# " to start a text comment.
Anyway, I'm curious about what you're doing since I've been doing more Python and // isn't available there. Don't you have a lot of code that's indented and would therefore start with "# " when you comment it out? How do you distinguish that from a textual comment?
In python you can also just use triple quoted strings in as comments. Think doc-strings.
On Aug 8, 2008, at 19:26, Rob McBroom wrote:
On 2008-Aug-8, at 12:44 PM, Mikael Høilund wrote:
Personally, I use the convention of "#" to start a code comment, and "# " to start a text comment.
Anyway, I'm curious about what you're doing since I've been doing more Python and // isn't available there. Don't you have a lot of code that's indented and would therefore start with "# " when you comment it out? How do you distinguish that from a textual comment?
I do most of my stuff in Ruby, where I just have the TM_COMMENT_START (in the Ruby “Comments” Preference inside the Bundle Editor) option set to "#" instead of "# ", and use ⌘/ to comment out a line.
This works out great because if I want to comment out a line of code, it's already there, so ⌘/ makes it a “code comment.” If I want to make a text comment, I start by making the comment marker, so the caret is already right where I need to make the space.
Aw, don't tell me you're one of those people that uses tabs to indent. :)
No.
On 2008-Aug-8, at 3:56 PM, Mikael Høilund wrote:
I do most of my stuff in Ruby, where I just have the TM_COMMENT_START (in the Ruby “Comments” Preference inside the Bundle Editor) option set to "#" instead of "# ", and use ⌘/ to comment out a line.
More importantly, you probably don't have TM_COMMENT_DISABLE_INDENT set to "yes" like I do. I'm so used to it, I forget that it's not default behavior. I think that answers my question.
--- Rob McBroom http://www.skurfer.com/
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.