Skip to content

[Regression] copyCompileCommands not copying the file in 1.20.52 update #4294

Closed

Description

@acyr

Brief Issue Summary

cmake.copyCompileCommands works in 1.19.52.
After updating to latest 1.20.52 extension the no longer copies the file.
From the debug output it seems that the file path is incomplete and not expanded properly, compared to the previous extension release.

CMake Tools Diagnostics

{
  "os": "win32",
  "vscodeVersion": "1.97.2",
  "cmtVersion": "1.20.52",
  "configurations": [
    {
      "folder": "c:\\develop",
      "cmakeVersion": "3.29.6",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": true,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": false
    }
  ]
}

Debug Log

[extension] Not updating the configuration provider because "C_Cpp.intelliSenseEngine" is set to "Disabled"
[main] Copying compile_commands.json from c:/develop/cmake_bld/dbg/compile_commands.json to compiler_commands.json
[extension] [9312] cmake.cleanConfigure finished (returned {"result":0,"resultType":0})
[extension] [8976] cmake.logDiagnostics started
[extension] [8976] cmake.logDiagnostics finished (returned undefined)

Additional Information

Log from 1.19:

[extension] Not updating the configuration provider because "C_Cpp.intelliSenseEngine" is set to "Disabled"
[expand] expanded ${workspaceFolder}/../compiler_commands.json
[main] Copying compile_commands.json from C:\develop\cmake_bld\dbg\compile_commands.json to c:/develop/../compiler_commands.json
[extension] [4267] cmake.cleanConfigure finished (returned {"result":0,"resultType":0})

Activity

  1. gcampbell-msft commented on Feb 24, 2025

    @gcampbell-msft
    Collaborator

    acyr (@acyr) Is it not getting copied at all? Or is it simply not getting copied to the same location? Either way, it seems like a bug based on your description, but I want to make sure I understand

  2. gcampbell-msft commented on Feb 24, 2025

    @gcampbell-msft
    Collaborator

    Also, could you copy the debug log with the logging settings set to debug for 1.20? It seems like maybe it isn't since I don't see the expansion output.

  3. acyr commented on Feb 24, 2025

    @acyr
    Author

    It's not getting copied at all, regardless of path I tried. I did not try a hardcoded path, always ${workspaceFolder} relative though.

    I had same logging settings in both cases. I think the lack of expansion might be the problem.

  4. gcampbell-msft commented on Feb 24, 2025

    @gcampbell-msft
    Collaborator

    Are you able to provide a minimal repro zip file?

    Or, the only two PR's that affected this feature that were in 1.20 are here: k0zmo@31372d6, k0zmo@74dce13. If you have a machine set up to debug, you could debug to help us identify the issue immediately.

  5. gcampbell-msft commented on Feb 24, 2025

    @gcampbell-msft
    Collaborator

    I may have identified the issue, I'll follow up momentarily with a vsix for you to test.

  6. gcampbell-msft commented on Feb 24, 2025

    @gcampbell-msft
    Collaborator

    acyr (@acyr) Could you test with this vsix and see if it fixes your issue? If it does, I'll open a PR with the changes:

    cmake-tools.zip

    You'll need to download, modify the extension to .vsix, and then install manually before trying your repro.

  7. acyr commented on Feb 24, 2025

    @acyr
    Author

    Yup, that works.

    [extension] Not updating the configuration provider because "C_Cpp.intelliSenseEngine" is set to "Disabled"
    [expand] expanded ${workspaceFolder}/../compiler_commands.json
    [main] Copying compile_commands.json from c:/develop/cmake_bld/dbg/compile_commands.json to c:/develop/compiler_commands.json
    [extension] [5707] cmake.cleanConfigure finished (returned {"result":0,"resultType":0})
    
  8. gcampbell-msft commented on Feb 25, 2025

    @gcampbell-msft
    Collaborator

    PR here: #4298

  9. moved this from Blocked to Completed in CMake Toolson Feb 26, 2025
  10. Amy-Li03 commented on Mar 20, 2025

    @Amy-Li03
    Collaborator

    Verified this on cmake tools v1.21.7(pre-release), copyCompileCommands copy the file correctly.

    Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buga bug in the product

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions