microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.48k stars 456 forks source link

Double-clicking on one of a target's "References" does nothing #3885

Open thokra1 opened 4 months ago

thokra1 commented 4 months ago

Brief Issue Summary

The project outline currently correctly lists referenced targets of a target correctly. But double-clicking currently does nothing.

Expected behavior

On double-clicking a reference, open the CMake file containing the corresponding add_executable, add_library etc. call and scroll to the respective line.

This is the current behavior of Visual Studio 2022 when opening a folder containing a CMake project.

Actual behavior

Nothing happens.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

VS Code: 1.91.0 Tested extension version: v1.18.42

Yingzi1234 commented 4 months ago

@thokra1 Thank you for your github issue! We can't reproduce your issue, you can get the reproduction below. Please let us know if the reproduction steps are incorrect!

ENV:

  1. VSCode version: v1.91.0
  2. CMake Tools version: v1.19.17(pre-release)
  3. C/C++ version: v1.21.0(pre-release)

Repro steps:

  1. Open an any folder by VSCode
  2. Open the CMakeProject1.cpp file and hover the mouse over target "Cout"
  3. Press F12+Shift and double-click on the reconstructed line that appears on the right side of the screen
  4. Check if you can navigate to the right place

Actual result: After double-clicking on the refactored row, it navigates to the correct page 3885

thokra1 commented 4 months ago

@Yingzi1234 there has been a misunderstanding here. I'm not talking about references in code. I'm talking about the "References" of a target in the project outline.

Consider these outlines in VS Code and VS22: image image

We have an executable "derp" that links against the static lib "lib". In the list of "References" of derp, you see "lib" showing up and double-clicking on the reference in Visual Studio 2022 jumps directly to the corresponding piece of CMake code.

image

But doing that in VS Code does no such thing.

Indicentally, in Visual Studio 2022, double-clicking any target or reference in the outline will take you to the corresponding CMake code - expanding/collapsing only seems to happen when using the arrow. VS Code instead expands or collapses targets in the project outline and does nothing for target references.

Dunno if this is intended (it probably is for regular targets) but it awkward that VS Code and VS22 differ here.

@gcampbell-msft Would you agree that aligning the behavior here a little more makes sense or is the way VS22 is handling this not viable in your opinion?

Also as an aside: imported libraries are not referenced at all, not even in VS22, which is a bit weird. Dunno is that is intended or not possible to do at the moment, but it seems inconsistent.

Yingzi1234 commented 4 months ago

@thokra1 To better address your question, could you provide us with a copy of your reproduction recording and reproduction project? Thank you in advance!

gcampbell-msft commented 4 months ago

@Yingzi1234 @thokra1 I know what the customer is referring to. There is a "references" dropdown in the Project Outline pane, and in Visual Studio, upon double clicking, it opens the CMakeLists.txt of that reference. We don't currently have support for that in VS Code.

I will mark this as an enhancement request for this feature! Thanks for your interest and use of the Project Outline view.