vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Project outline does not show sources of custom targets with commands

Open thokra1 opened this issue 1 year ago • 5 comments

Brief Issue Summary

Expected behavior

Show files listed in the SOURCES list of a custom target.

Visual Studio 2022 shows the whole list of sources including the proper hierarchy, if any.

Actual behavior

Source files and folder structure, if any, are not shown.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

VS Code version: 1.91.0 Version of the extension: v1.18.42

thokra1 avatar Jul 10 '24 08:07 thokra1

@gcampbell-msft We can reproduce the issue as detailed below. But we are not sure if this is by design, could you help us to see it? Thanks!

ENV:

  1. VSCode version: v1.91.0(user setup)
  2. C/C++ version: v1.21.0(pre-release)
  3. CMake tools version: v1.19.18(pre-release)

Repro steps:

  1. Create a standard CMake project with CMake presets
  2. Click F1 and run "CMake: configure"
  3. Go to the CMake page to see if the "Project Outline" is fully displayed

Actual result: Only shows the "CMakeLists.txt" and "main.cpp" and "CMakePresets.json" file on "Project Outline" page 3886

Yingzi1234 avatar Jul 11 '24 09:07 Yingzi1234

@Yingzi1234 The GIF doesn't show a custom target, but a regular executable. The latter work fine. This report is about custom targets, i.e. targets added with add_custom_target(..... SOURCES ...) that don't work.

thokra1 avatar Jul 11 '24 09:07 thokra1

Just noticed that it works fins for custom targets that don't specify any COMMANDs. I have not tested any further.

Consider this snippet:

add_custom_target(schmerp COMMAND npm install WORKING_DIRECTORY . SOURCES gerp.js )

In VS 22 we then have image

but in VS Code we have image

Removing the COMMAND yields the following in VS Code image

thokra1 avatar Jul 11 '24 09:07 thokra1

@gcampbell-msft We can reproduce the issue as detailed below. Please let me know if you have any concern! Thank you!

ENV:

  1. VSCode version: v1.91.1(user setup)
  2. C/C++ version: v1.21.0(pre-release)
  3. CMake tools version: v1.19.22(pre-release)

Repro steps:

  1. Create a standard CMake project with CMake presets
  2. Click F1 and run "CMake: configure"
  3. Copy the below code to CMakeListst.txt file add_custom_target(schmerp COMMAND npm install WORKING_DIRECTORY . SOURCES gerp.js )
  4. Go to ‘CMake Project Outline’ to see if the full list is shown
  5. Go to CMakeLists.txt file and delete the code COMMAND npm install
  6. Go to ‘CMake Project Outline’ to see if the full list is shown

Actual result: Remove the code and the gerp.js file will appear in the list Issue3886

Yingzi1234 avatar Jul 17 '24 07:07 Yingzi1234

@thokra1 This is an interesting use case, however, we do attempt to mirror functionality from VS here, so I will mark it as an enhancement request for the Project Outline view! Thanks.

gcampbell-msft avatar Jul 19 '24 13:07 gcampbell-msft

If DEPENDS is added to the custom target, vscode also doesn't show the SOURCES files.

fr89k avatar Oct 23 '24 12:10 fr89k