I've just tried that but it parses all files at once right?
I believe the behavior is still the same. I just moved the code around a bit, so only difference should be in timing. It parses each file separately, storing the result in `data->source_files` and `tm_workspace_add_source_files(data->source_files)` is called only once, after all files are processed.
I think ctags isn't re-entrant so it would be hard to do. The big advantage of the single-threaded approach is the simplicity of the implementation and simplicity to reproduce bugs.
It doesn't have to be reentrant, as long as you always parse whole file at once and do it in one thread only. Actually, it could even work in single-threaded architecture. The processing tasks could be queued and processed by in idle handler. Every programmer stops once in a while to think, so the parsing could be done easily in those pauses.
I was actually thinking about one thing - it would be possible to create a ctags-backed LSP server living in a separate process doing something similar to what tag manager does in Geany. But I'm not sure if I'm sufficiently motivated to do something like that myself :-).
Yes, this exact idea crossed my mind today too :smile: It might solve some of the issues of that PR, by removing the ctags code from geany into LSP and making (I assume) most of the TM unnecessary. So all that would remain in Geany would be LSP support.
Is the original performance problem with double-parsing too big?
I have actually optimized the parser a lot. Ctags binary can now parse all files in my biggest Kotlin project in under 2s, which would be quick enough for most common uses. The problem is that I'm used to work on remote sources over sshfs, which adds more overhead. So I was looking into some cheap ways to optimize it along the way and removing double parsing in ProjectOrganizer *looked* like low hanging fruits... I guess I was bit too optimistic this time.
Anyway, I'm quite okay if you say neither of those two PRs is worth the trouble. It was a nice exercise in C and I learned bit more about geany internals and plugins, so I've gained something if the code is not merged in the end.