I am not sure, what codetools means. However the word suggests, that it may be similar to a situation I came across several times:
Most features that need to "understand" pascal.
Most well known: code completion (the drop down, but also creating local vars...).
It also does refactoring from the menu.
And it does automatic insertion of "end" if you press return after a new "begin".
And it can do some indent, if set up to do...
I like developing by using existing code. For this, I copy whole methods and paste them to create something new with their lines.
When you paste, does your code get re-indented?
That would be codetools (first page of codetools options).
And quite a few people may have that "smart indent" turned off. So that would be a feature only some (not sure how many, could be half, could be 75% or 25%....) users would use.
It then may also depend on what that code contains.
There are a few known issue (albeit not sure about crashes) when codetool encounters generics...
There is a lot to be aware of: Give them a new name, care for a not existing name, place it somewhere into context with other functions within the class. Be aware of begin and end in every loop. Very helpful is that I made the IDE drawing a line under every method. If the "end;" is under this line, it is a severe warning of messed loop.
The lines are the highlighter / that is not codetools.
The highlighter is the 2nd part of the IDE that understands Pascal.
In this work, it happens frequently that anything gets messed. e.g. I forget to delete a
functiion TMyClass.myMethod: TmyIdea; or a begin end block is lost. Or the click-event from one button shall be copied to the event for another button and this is messed.
In which case you probably start getting errors from codetools when you try to "jump to declaration/implementation", or complete code. Watch the IDE's messages window.
Mind that this also may severely affect the designer, especially when you try to create new events (OnClick, etc).
Sure, in this case the compiler is puzzled. Worse, if I try to double-click a button to jump to its click-event to fix it. In the best case, the IDE says "I cannot hop there". In the worst case, ... bye bye IDE, bye bye all changes of the last hour... How to file it? It is gone!
Yes, that be a complicated case.
Because it may not just be the state immediately before. It may be which other states the IDE has been in. There are caches that can go wrong.
But a first point is trying to get a stack trace.
That might at least allow to circumvent the crash, and have an error instead. (At least it improves chances that can be done)
If the IDE runs with a logfile, it may still be able to write that trace.
If it does not, it will be more work. It would mean to run the IDE in the debugger, until it crashes.
You are on Windows?
In the lazarus folder open "cmd.exe"
(In the windows explorer, while looking at the folder replace the directory in the edit with "cmd.exe" and press return)
Then run (you need full path to gdb which is inside lazarus install mingw\gdb)
gdb -ex r -ex bt ./lazarus
You may need to confirm "Enable debuginfod for this session? (y or [n]) " with N if it asks.
When lazarus crashes it should show a stacktrace.
You can put that in a .bat file (but someone needs to check how to disable the debuginfod quesiton)