dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.97k stars 4.03k forks source link

Intellisense in: when calling method just above method declaration #72077

Open daumast opened 8 months ago

daumast commented 8 months ago

Type: Bug

Issue Description

Intellisense doesn't show method when typing just above method declaration

Steps to Reproduce

// showing Intellisense for MyMethod

Console.WriteLine();

// NOT showing Intellisense for MyMethod

void MyMethod() { }

// showing Intellisense for MyMethod

Expected Behavior

MyMethod shown on Intellisense when typing above method declaration

Actual Behavior

Not showing

Logs

C# log

LogForIntellisenseAndMyMethod.zip

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

C# Extension: 2.15.30 Using OmniSharp: false

Dotnet Information .NET SDK: Version: 8.0.101 Commit: 6eceda187b Workload version: 8.0.100-manifests.69afb982 Runtime Environment: OS Name: Windows OS Version: 10.0.19045 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.101\ .NET workloads installed: Workload version: 8.0.100-manifests.69afb982 There are no installed workloads to display. Host: Version: 8.0.1 Architecture: x64 Commit: bf5e279d92 .NET SDKs installed: 8.0.101 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Other architectures found: None 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| |---|---|---|---| |csdevkit|ms-dotnettools|1.3.10|ms-dotnettools.csdevkit-1.3.10-win32-x64| |csharp|ms-dotnettools|2.15.30|ms-dotnettools.csharp-2.15.30-win32-x64| |docomment|k--kato|1.0.0|k--kato.docomment-1.0.0| |ilspy-vscode|icsharpcode|0.17.0|icsharpcode.ilspy-vscode-0.17.0| |material-icon-theme|PKief|4.33.0|pkief.material-icon-theme-4.33.0| |msbuild-project-tools|tintoy|0.6.0|tintoy.msbuild-project-tools-0.6.0| |rest-client|humao|0.25.1|humao.rest-client-0.25.1| |vscode-dotnet-runtime|ms-dotnettools|2.0.1|ms-dotnettools.vscode-dotnet-runtime-2.0.1| |vscodeintellicode-csharp|ms-dotnettools|0.1.26|ms-dotnettools.vscodeintellicode-csharp-0.1.26-win32-x64|;

Extension version: 2.15.30 VS Code version: Code 1.86.0 (05047486b6df5eb8d44b2ecd70ea3bdf775fd937, 2024-01-31T10:28:19.990Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Pentium(R) CPU G840 @ 2.80GHz (2 x 2794)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: disabled_off
opengl: enabled_on
rasterization: unavailable_off
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: unavailable_off
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|7.85GB (0.46GB free)| |Process Argv|--crash-reporter-id 16d6b610-0e87-48b1-a7d7-f3d8239b07cb| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vscorecescf:30445987 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 vscrpc:30673769 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 dsvsc019b:30953937 edj9j583:30958191 3ef8e399:30949928 ```
dibarbet commented 7 months ago

This is also an issue in VS for Windows image

Going to transfer over to the Roslyn side for tracking./

CyrusNajmabadi commented 7 months ago

Doesn't repro within a method body:

image

So this is likely due to top level statements.