Author Topic: Spell Check feature that would be very helpful  (Read 1864 times)

Dennis

  • Senior Community Member
  • Posts: 3983
  • Hero Points: 517
Spell Check feature that would be very helpful
« on: March 18, 2024, 07:56:09 PM »
When spell-checking code, it would be helpful for the spell-checker to break down camel-case words.  So that "maximumOffPaathTolerance" would not be spell-checked as a single misspelled word, but four words.  In this case, each one would each pass spell checking except for "Paath".  Wouldn't it be clever for SlickEdit to catch that?

Dennis

  • Senior Community Member
  • Posts: 3983
  • Hero Points: 517
Re: Spell Check feature that would be very helpful
« Reply #1 on: March 18, 2024, 08:02:35 PM »
A follow-up to this feature would be to have a Spell check command to "Check except for keywords", that would spell check the entire source file, except for color-coded keywords and library symbols.  Then there is no spelling error for something like std::nullptr.

Dennis

  • Senior Community Member
  • Posts: 3983
  • Hero Points: 517
Re: Spell Check feature that would be very helpful
« Reply #2 on: April 10, 2024, 01:58:59 PM »
Attached is a patch that adds a few spell checking related items:

  • ability to spell-check subwords
  • def-var (def_spell_check_subwords) to turn on/off subword spell checking
  • spell-check-whole-file command to start spell checking at the top of the file
  • cur_subword() method to get the current subword under the cursor (independent of subword navigation options)

I added "spell-check-whole-file" to the Spell submenu as follows:
Code: [Select]
submenu "&Spell Check","help spell check menu","Displays menu of spell checking commands","ncw" {
         "Check from &Top","spell-check-whole-file","","help spell check menu","Spell check from top of file";
         "&Check from Cursor","spell-check","nrdonly|nicon","help spell check menu","Spell check starting from cursor";

The subword option is off by default, but it would probably be more useful turned on by default.

The one strength / weakness of the implementation is that when it encounters a CamelCase word, it will break it down and spell check the subwords, but never offer to let you add the whole word to your spell dictionary.  That's good because you do not have to click through symbols like "getBetterSpellChecker", which makes spell checking source code a lot faster. 

This does not integrate with live spell checking at all.