-
Notifications
You must be signed in to change notification settings - Fork 13
Description
I am poking around using the new LSP. From what I see, the compile_commands.json file is only regenerated when I do a build. That means whenever there is a change that can affect compile_commands, it is not immediately taken into account. That's not a great editing experience if, for example, I change my build variables or add source files I have to rebuild the entire project to get correct LSP features. Is this a known issue and will be fixed in the future or is it going to stay this way ?
I feel that compile_commands.json should be refreshed on every operation that can affect it to get correct behavior. I am interested only in managed builds. Examples
- Add or remove source files
- Rename source file
- Exclude / Include source file resource in build configuration
- Change build configuration properties
- Change build variables for build configuration
- Change preprocessor macros for build configuration
Dynamic variables that affect the build are a 'dont care', because there will not be a good way to handle them. They are not expected to cause a refresh of compile_commands.json. Only the snapshot of the variable would get used at the time of a refresh. Example: ${current_date}.
If the clean operation deletes the artifacts folder, the last step should be to re generate the artifacts folder containing a refreshed compile_commands.json
I don't know the implementation, so take this with a grain of salt. If the compile_commands.json file is how we are going to get correct LSP services, then a much smarter service should be implemented if overhead is a concern. Compile_commands should have an in memory cache that is modified / updated upon the above project modifications and written to disk if the disk copy does not match the in memory copy.