Eclipse has a great built-in source code parser and browser (aka ‘Indexer’). It is basically a built-in compiler which parses the source files and assists the user with code completion and navigation help, making Eclipse this awesome productivity tool. On the downside this background parsing could potentially slow down things, and therefore Eclipse has some default settings to prevent this. Unfortunately, the FreeRTOS Kernel ‘tasks.c’ file is above-and-beyond of a ‘sane’ source file and will hit the default limits: as a result the ‘tasks.c’ file is not indexed and things like ‘Open Declaration‘ might not work for the file ‘tasks.c’.
The issue is that the FreeRTOS file ‘tasks.c’ is huge: over 5000 lines of code!
💡 my rule of thumb is: if a source file is well above 1000 lines, it is better to think about to split it off into smaller modules.
But there is an easy solution: click on that link or go directly to the Scalability preference. The usual default setting is 5000 lines, so increase that to say 6000:
Press Apply, do not forget to close tasks.c (if open) and open the file again with the Outline view open: now it shall show all the symbols for it:
Now Indexing, symbol browsing, or jumping to declaration works for tasks.c :-).
This does not only apply for FreeRTOS tasks.c, but for any huge files going beyond the 5000 lines scalability setting: such huge files are not a problem for Eclipse (I have seen software stacks with >10k lines of code in a single file!), it is only that the 5K setting kicks in. But now you know as for everything in Eclipse: there is a setting for it. A good indication to check if the Indexer is working is using the Outline View.
Happy Indexing 🙂
- Open Declaration in Eclipse: https://mcuoneclipse.com/2020/07/20/eclipse-gems-tips-tricks-open-declaration/
- Fixing the Eclipse Indexer: https://mcuoneclipse.com/2012/03/20/fixing-the-eclipse-index/
- Eclipse Scalability: https://mcuoneclipse.com/2012/08/07/eclipse-editor-scalability/
- Outline View and Eclipse Shortcuts: https://mcuoneclipse.com/2012/04/15/10-best-eclipse-shortcuts/