dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 670 forks source link

Breadcrumbs do not include local functions #6767

Open jtsom opened 9 months ago

jtsom commented 9 months ago

Type: Bug

Issue Description

Breadcrumbs do not show local functions. This is particularly noticeable when using top level Programs as all functions declared inside are considered local functions (unless they are in a nested class).

Steps to Reproduce

Create a project using top level Program.cs. For example a minimal API application. Add some routines.

Expected Behavior

Able to navigate using breadcrumbs at the top of the window.

Actual Behavior

Cannot navigate, as the breadcrumbs do not show.

Logs

C# log

Using dotnet configured on PATH Dotnet path: C:\Program Files\dotnet\dotnet.exe Activating C# + C# Dev Kit + C# IntelliCode... waiting for named pipe information from server... [stdout] {"pipeName":"\\\\.\\pipe\\93c710d0"} received named pipe information from server attempting to connect client to server... client has connected to server [Info - 11:40:48 AM] [Program] Language server initialized [Info - 11:40:54 AM] [WorkspaceProjectFactoryService] Project E:\source\EF-API\EF-API\EF-API.csproj loaded by C# Dev Kit Using dotnet configured on PATH

C# LSP Trace Logs

Post the output from Output-->C# LSP Trace Logs here. Requires `dotnet.server.trace` to be set to `Trace`

Environment information

VSCode version: 1.86.0-insider C# Extension: 2.14.8 Using OmniSharp: false

Dotnet Information .NET SDK: Version: 8.0.100 Commit: 57efcf1350 Workload version: 8.0.100-manifests.71b9f198 Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.100\ .NET workloads installed: Workload version: 8.0.100-manifests.71b9f198 There are no installed workloads to display. Host: Version: 8.0.0 Architecture: x64 Commit: 5535e31a71 .NET SDKs installed: 3.1.426 [C:\Program Files\dotnet\sdk] 5.0.408 [C:\Program Files\dotnet\sdk] 6.0.125 [C:\Program Files\dotnet\sdk] 6.0.320 [C:\Program Files\dotnet\sdk] 6.0.417 [C:\Program Files\dotnet\sdk] 7.0.114 [C:\Program Files\dotnet\sdk] 7.0.311 [C:\Program Files\dotnet\sdk] 7.0.404 [C:\Program Files\dotnet\sdk] 8.0.100 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation] Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download
Visual Studio Code Extensions |Extension|Author|Version|Folder Name| |---|---|---|---| |azure-account|ms-vscode|0.11.6|ms-vscode.azure-account-0.11.6| |csdevkit|ms-dotnettools|1.2.5|ms-dotnettools.csdevkit-1.2.5-win32-x64| |csharp|ms-dotnettools|2.14.8|ms-dotnettools.csharp-2.14.8-win32-x64| |csharpextensions|kreativ-software|1.7.3|kreativ-software.csharpextensions-1.7.3| |ecdc|mitchdenny|1.8.0|mitchdenny.ecdc-1.8.0| |git-graph|mhutchie|1.30.0|mhutchie.git-graph-1.30.0| |hexeditor|ms-vscode|1.9.12|ms-vscode.hexeditor-1.9.12| |hl7tools|RobHolme|2.0.6|robholme.hl7tools-2.0.6| |jwt-debugger|yokawasa|0.5.0|yokawasa.jwt-debugger-0.5.0| |kanagawa|qufiwefefwoyn|1.5.1|qufiwefefwoyn.kanagawa-1.5.1| |live-server|ms-vscode|0.5.2023121201|ms-vscode.live-server-0.5.2023121201| |material-icon-theme|PKief|4.32.0|pkief.material-icon-theme-4.32.0| |msbuild-project-tools|tintoy|0.5.3|tintoy.msbuild-project-tools-0.5.3| |night-owl|sdras|2.0.1|sdras.night-owl-2.0.1| |quicktype|quicktype|12.0.46|quicktype.quicktype-12.0.46| |rainbow-csv|mechatroner|3.9.0|mechatroner.rainbow-csv-3.9.0| |rest-client|humao|0.25.1|humao.rest-client-0.25.1| |sync-scroll|dqisme|1.3.1|dqisme.sync-scroll-1.3.1| |TabOut|albert|0.2.2|albert.tabout-0.2.2| |vscode-azureappservice|ms-azuretools|0.25.1|ms-azuretools.vscode-azureappservice-0.25.1| |vscode-azurefunctions|ms-azuretools|1.13.1|ms-azuretools.vscode-azurefunctions-1.13.1| |vscode-azureresourcegroups|ms-azuretools|0.8.3|ms-azuretools.vscode-azureresourcegroups-0.8.3| |vscode-azurestorage|ms-azuretools|0.15.3|ms-azuretools.vscode-azurestorage-0.15.3| |vscode-base64|adamhartford|0.1.0|adamhartford.vscode-base64-0.1.0| |vscode-cosmosdb|ms-azuretools|0.20.0|ms-azuretools.vscode-cosmosdb-0.20.0| |vscode-dotnet-runtime|ms-dotnettools|2.0.0|ms-dotnettools.vscode-dotnet-runtime-2.0.0| |vscode-thunder-client|rangav|2.16.3|rangav.vscode-thunder-client-2.16.3| |vscodeintellicode|VisualStudioExptTeam|1.2.30|visualstudioexptteam.vscodeintellicode-1.2.30| |vscodeintellicode-csharp|ms-dotnettools|0.1.26|ms-dotnettools.vscodeintellicode-csharp-0.1.26-win32-x64| |xml|DotJoshJohnson|2.5.1|dotjoshjohnson.xml-2.5.1|;

Extension version: 2.14.8 VS Code version: Code - Insiders 1.86.0-insider (9621add46007f7a1ab37d1fce9bcdcecca62aeb0, 2023-12-20T05:36:57.756Z) OS version: Windows_NT x64 10.0.22631 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz (6 x 3000)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.78GB (12.42GB free)| |Process Argv|--crash-reporter-id 362817d9-b661-4b35-92b7-fe18e5872851| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv695:30137379 vsins829:30139715 vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256198 vslsvsres303:30308271 pythontb:30258533 pythonptprofiler:30281269 vshan820:30294714 vscod805cf:30301675 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30404738 py29gd2263:30784851 vsclangdf:30492506 c4g48928:30535728 dsvsc012cf:30540253 vscrp:30624060 a9j8j154:30646983 showlangstatbar:30737417 fixshowwlkth:30771523 showindicator:30805243 pythongtdpath:30726887 i26e3531:30792625 welcomedialog:30812478 pythonidxpt:30768918 pythonnoceb:30776497 asynctok:30898717 dsvsc013:30777762 dsvsc014:30777825 pythonmpsinfo:30901776 dsvsc015:30821418 pythontestfixt:30866404 pythonregdiag2:30902439 pyreplss1:30879911 pythonmypyd1:30859725 pythoncet0:30859736 pythontbext0:30879054 accentitlementst:30870582 dsvsc016:30879898 dsvsc017:30880771 dsvsc018:30880772 aa_t_chat:30882232 cp7184t:30925682 ```
dibarbet commented 9 months ago

So this is what I see with a top level Program.cs file in a minimal API project (and is what I would expect). There is a breadcrumb at the top with 'Program' image

Note - you will not see entries for the LocalFunction because its considered a local function inside the class. If you have a nested class, that will show up. image

Are you seeing something different, if so would you mind sharing what that is? If the problem is the missing breadcrumbs for local functions, I'm open to that request.

jtsom commented 9 months ago

Yes, that is exactly what I am seeing. None of the "local functions" in the Program.cs show up in the breadcrumbs - just "Program.cs". Makes it hard to navigate if the program.cs file is getting large. Being able to jump around to the local functions would be expected and helpful.

dibarbet commented 9 months ago

Got it, I've updated the issue to match. This is particularly noticable in projects using top level statements (due to all functions being local functions)