Skip to content

compile_commands refresh #521

@LostTime76

Description

@LostTime76

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

  1. Add or remove source files
  2. Rename source file
  3. Exclude / Include source file resource in build configuration
  4. Change build configuration properties
  5. Change build variables for build configuration
  6. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions