Re: NSSpellChecker -ignoreWord:… for NSTextCheckingTypeGrammar?
Re: NSSpellChecker -ignoreWord:… for NSTextCheckingTypeGrammar?
- Subject: Re: NSSpellChecker -ignoreWord:… for NSTextCheckingTypeGrammar?
- From: Troy Stephens <email@hidden>
- Date: Tue, 20 Aug 2013 16:18:41 -0400
Thanks for the reply, Doug! Sorry, I somehow didn’t notice it had come in until just now.
I’ll file an ER for suitable API (or for updating the docs, if the conclusion is not to provide one). Since I’m using NSSpellChecker with my own, WebView-based content view, I don’t get the benefit of AppKit’s automatic “Ignore” tracking for NSTextViews. So I probably will go the “maintain my own list” route for now, handling -ignoreSpelling: invocations differently when the active result is a grammar result — thanks for confirming that’s an appropriate approach.
Regards,
Troy
On Aug 16, 2013, at 9:01 PM, Douglas Davidson <email@hidden> wrote:
> Troy, you can file an enhancement request specifically for an "ignore grammar" API, but currently how it works is that if the last shown checking result is a grammar checking result, then ignoring the word underlined by that result will cause that grammar checking result to be ignored.
>
> It would be perfectly reasonable for you to maintain your own ignore list and filter grammar-check results based on it.
>
> Douglas Davidson
>
> On Aug 8, 2013, at 7:41 AM, Troy Stephens <email@hidden> wrote:
>
>> Is NSSpellChecker’s “ignored words” API meant for use with grammar-checking results too?
>>
>> Seems unlikely to me, and yet that’s what appears to be indicated by the documentation and apparent lack of corresponding “-ignoreGrammar…” API.
>>
>> The Spelling and Grammar panel sends -ignoreSpelling: when the user clicks “Ignore” for a grammar-check result, the same as it would do for a spell-check result. And the implementation example in the -ignoreSpelling: reference documentation unconditionally invokes -ignoreWord:inSpellDocumentWithTag:
>>
>> - (void)ignoreSpelling:(id)sender {
>> [[NSSpellChecker sharedSpellChecker] ignoreWord:[[sender selectedCell] stringValue] inSpellDocumentWithTag: myDocumentTag];
>> }
>>
>> https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSIgnoreMisspelledWords_Protocol/
>>
>> It’s hard to tell whether the same technique is really meant to be applicable to ignored grammar results, and this bit of documentation wasn’t seen as needing updating when grammar-checking was added, or whether the documentation is in need of update.
>>
>> In the absence of clear info, seems like I should take care to invoke -ignoreWord:… for spell-check results only. If want to be able to ignore grammar results, maybe I need to maintain my own grammar “ignore” list and filter received grammar-check results based on it.
>>
>> Info appreciated if anyone else has run into this. My searching hasn’t turned up any answers.
>>
>> --
>> Troy Stephens
>> Developer of TypeMetal: The Visual HTML Editor for OS X
>> http://coherencelabs.com/typemetal/
>>
>>
>>
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden