cppit / jucipp

A lightweight & cross-platform IDE supporting the most recent C++ standards. This project has moved to https://gitlab.com/cppit/jucipp.
https://gitlab.com/cppit/jucipp
MIT License
883 stars 98 forks source link

support compile_commands.json #344

Closed artisdom closed 7 years ago

artisdom commented 7 years ago

Sometimes it might not be easy to setup a project to be built inside Juci, but compile_commands.json is readily available. It can be used as input for indexing the project and then code navigation.

eidheim commented 7 years ago

You can create a bare CMakeLists.txt or meson.build that only includes a line defining the project. Then, if compile_commands.json can be found in the build directory, this file will be used to parse the various c/c++ files.

artisdom commented 7 years ago

It works great, thanks.

Another question, how to pre-cache the whole project using the supplied compile_commands.json ?

I really like the new feature "Fixes #251: Go to Usage and Rename now includes unopened files", for large code base(~2 Giga), it could take a long time for the indexing and caching to finish.

eidheim commented 7 years ago

Glad to hear, and thank you.

The common recommendation is to divide your project into smaller parts (2 GB is quite large). That said, I have done some optimisations to speed up things, and the parse when needed is a good tradeoff at the most common work flows Today (swapping between git branches and git rebasing). The problem with indexing in the background is that you would do a lot of unnecessary parsing when changing a base header file multiple times without finding usages in between the changes. Also, now, only the source files that might contain the searched for usages are parsed, that is, instead of the whole project. And some of the source files would maybe not need to be parsed at all. Finally, worth mentioning is that opened files will not be reparsed when searching for usages.

So my recommendation is basically to sit back and enjoy your tea/coffee when finding usages for the first time on a large project:)

artisdom commented 7 years ago

Will Juci support LSP, then we can integrated with clangd when it's ready.

eidheim commented 7 years ago

Clangd is an interesting project that I am following closely, but currently they are quite far behind what we already have in juCi++. Hopefully, in a few years, things might have improved.