Recent

Author Topic: Spell checking for IDE source editor -- Lazarus 4.99  (Read 594 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12428
  • Debugger - SynEdit - and more
    • wiki
Spell checking for IDE source editor -- Lazarus 4.99
« on: June 02, 2026, 05:01:46 pm »
Lazarus has a new package SynEditSpellChecker and SynEditSpellCheckerDsgn.

You can install the latter into your IDE, and get spell checking in the source editor.

It requires ASpell.

- On Linux you should be able to install this via your distros repo.
- For Window (64bit), there is a build available here https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/ASpell%200.60.8.2%20for%20SynSpell%20plugin%20-%20Lazarus%204.99%20and%20up/
- Sorry, no pre-build for Windows 32bit.

paweld

  • Hero Member
  • *****
  • Posts: 1641
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #1 on: June 03, 2026, 07:30:49 am »
Hi @Martin_fr,
Thank you for your work.

I installed the component, downloaded the files, configured the paths (to the DLL file, to the “data” directory, and to the custom dictionary file) and the language (pl - I copied the files to the “data” directory), but I think I made a mistake somewhere, because it started underlining most words (unit names, variables, and even correctly spelled Polish words).
Generally, I imagined that the checking would apply to comments and strings, not to the entire code in the file.
Best regards / Pozdrawiam
paweld

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12428
  • Debugger - SynEdit - and more
    • wiki
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #2 on: June 03, 2026, 08:31:19 am »
First of all, I assume (since you did not mention) that the setup screen did not show any error (when all fields were set)?

Errors would be shown in red, right below the 4 top edits. You can easily check that they appear, by e.g. setting language to "fr" when you don't have a french dict.

I tested with English and German.

I forgot to mention one important detail.
Because there isn't a full Unicode processor in SynEdit yet, it doesn't know what Unicode chars are "word chars" and wich are "word break chars" (e.g. all kind of spaces, or dashes that Unicode has)

So if you have chars outside A..Z then you need to enter them in the fields "Unicode upper/lower chars"
E.g.:
For German there should be: "äöü" and "ÄÖÜ"
For French would need all the accented chars...





It also checks source code. But you have settings to affect how. (and those apply for comments (and strings) too, since comments for many people contain identifier names. (e.g. class or procedure names)

It does ignore words that the HL knows. (Currently only the Pascal HL does report support that, and "known" are keywords and modifiers (stdcall). There are still some missings, e.g. AnsiString should be known (but is not), if the option to highlight "all string types" is off. (And the HL does not know those inside of comments or strings, though that is actually correct imho, as it can't tell if a comment is commented source or other text => stdcall is not a word in normal text)

As for checking comments/string only. That may still get added.



Settings:

It can check TSpellDictionary as "T" (ignored), "Spell" (ok) and "Dictionary" (ok)
=> The "T" can be in the field "List of chars (prefix) to ignore at the start of word"
     Ignoring is not forced, but tested to match either: TRACTION is tested to be correct as "T","RACTION" or "TRACTION". (if either returns ok, then good)

Then ChkAnswer => Split into "Chk" and "Answer" (if it isn't a word in its entire): You can  set to ignore parts that are 3 or shorter.

paweld

  • Hero Member
  • *****
  • Posts: 1641
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #3 on: June 03, 2026, 09:17:37 am »
I set it up exactly as you described - I’ve attached a screenshot (I reinstalled the package).
A test with a non-existent language displays the appropriate message.
Best regards / Pozdrawiam
paweld

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12428
  • Debugger - SynEdit - and more
    • wiki
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #4 on: June 03, 2026, 09:41:35 am »
If you right click any of the marked words, does it print show suggestions in the popup menu?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12428
  • Debugger - SynEdit - and more
    • wiki
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #5 on: June 03, 2026, 10:16:57 am »
I have to rebuild the dicts.

I had a typo in my $PATH - and it only affected some builds.

paweld

  • Hero Member
  • *****
  • Posts: 1641
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #6 on: June 03, 2026, 10:21:08 am »
Quote from: Martin_fr
If you right click any of the marked words, does it print show suggestions in the popup menu?
yes
Quote from: Martin_fr
I had a typo in my $PATH - and it only affected some builds.
Perhaps this is why the module won't work in another Lazarus instance - the parent directory is C:\_dev\laz_test - error: "Unable to load library: 126"

The main version (C:\Lazarus - works) and the test version (C:\_dev\laz_test - does not work) are both Laz trunk + FPC 3.2-fixes x86_64.

After commit c75f2c28a635391bfe137c29030215e2f5233ec7 check only comments and strings - thank you ver much, but it still highlights correct words.
« Last Edit: June 03, 2026, 10:46:04 am by paweld »
Best regards / Pozdrawiam
paweld

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12428
  • Debugger - SynEdit - and more
    • wiki
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #7 on: June 03, 2026, 11:07:10 am »
I did rebuild the dictionaries. Please update your dictionary.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12428
  • Debugger - SynEdit - and more
    • wiki
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #8 on: June 03, 2026, 11:18:14 am »
Quote from: Martin_fr
I had a typo in my $PATH - and it only affected some builds.
Perhaps this is why the module won't work in another Lazarus instance - the parent directory is C:\_dev\laz_test - error: "Unable to load library: 126"

The main version (C:\Lazarus - works) and the test version (C:\_dev\laz_test - does not work) are both Laz trunk + FPC 3.2-fixes x86_64.

The PATH was for running "make" for each dictionary. The dictionaries are not part of the main distribution. Each dictionary comes as individual tar, as source. So I had a shell script "for a in $(ls *.bz2)" and called configure and make for each of them. That of course needs to find the installed aspell with all its tools. And there I had a mistake in the PATH, and some dicts didn't fully build. Also found a bug in one of their Makefiles...

Given the amount dictionaries, I can't load each and everyone in my IDE to see if it works, or if it has all words that it should have...
(In theory it should be possible to copy the dictionaries from e.g. a Linux distro build of aspell 0.60.n, and then use them with the Windows dll / but I went with the build them...)




I am not sure what happens with the loading. It shouldn't matter were your Lazarus is installed (mine is on the "B:" drive). The dll was build in msys => that doesn't even know that I have Lazarus, so the dll couldn't possible have any data on where Lazarus is.

Error 126 is
Quote
The specified module could not be found.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12428
  • Debugger - SynEdit - and more
    • wiki
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #9 on: June 03, 2026, 11:25:03 am »
And another note.

Currently only one dict can be used. I haven't decided on adding support for several dictionaries.

paweld

  • Hero Member
  • *****
  • Posts: 1641
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #10 on: June 03, 2026, 12:10:26 pm »
Thank you very much. After updating the dictionaries, everything works fine.

As for error 126, I also found the cause - additional libraries are required in the Lazarus directory:
- libgcc_s_seh-1.dll
- libiconv-2.dll
- libintl-8.dll
- libstdc++-6.dll
- libwinpthread-1.dll
I have them installed in the main Lazarus installation because they are required to support “cairo”
Best regards / Pozdrawiam
paweld

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12428
  • Debugger - SynEdit - and more
    • wiki
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #11 on: June 03, 2026, 01:26:29 pm »
Done some more testing... There is indeed some dependency I hadn't found.

I will try to rebuild without.

paweld

  • Hero Member
  • *****
  • Posts: 1641
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #12 on: June 04, 2026, 03:05:43 pm »
I noticed that even though I enabled validation only for comments and strings, it’s still performing checks in other parts of the code - please see the attached screenshot.
Best regards / Pozdrawiam
paweld

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12428
  • Debugger - SynEdit - and more
    • wiki
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #13 on: June 04, 2026, 03:52:55 pm »
I tried (and succeeded) to reproduce according to you image.

It seems that it happens in code after a string?
Also after a comment:  { foo } DoXyxyzz;

If you have examples that differ from that observation please let me know.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12428
  • Debugger - SynEdit - and more
    • wiki
Re: Spell checking for IDE source editor -- Lazarus 4.99
« Reply #14 on: June 04, 2026, 04:10:14 pm »
Should be fixed.

Copied and pasted in the wrong order... (read data, before requesting it)

 

TinyPortal © 2005-2018