vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Constructor signature not displayed when the constructed object is a method parameter

Open spajus opened this issue 2 years ago • 3 comments

Type: Bug

Issue Description

Constructor does not show any hints when typing if the object you are trying to construct is used as an inline method parameter.

Steps to Reproduce

Try to type the following code, it will not show hints when you do "list.Add(new Point("

            // Constructor hints appear after typing new Point(
            var point = new Point(1, 2);
            var list = new List<Point>();
            list.Add(point);

            // Constructor hints DO NOT appear after typing new Point(
            list.Add(new Point(1, 2));

Expected Behavior

Constructor hints should be visible when building an object inline as a parameter.

Actual Behavior

Constructor hints do not show up.

Logs

C# log

Post the output from Output-->C# here

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.81.1 C# Extension: 2.0.376 Using OmniSharp: false

Dotnet Information .NET SDK: Version: 7.0.302 Commit: 990cf98a27

Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.302\

Host: Version: 7.0.5 Architecture: x64 Commit: 8042d61b17

.NET SDKs installed: 5.0.412 [C:\Program Files\dotnet\sdk] 6.0.402 [C:\Program Files\dotnet\sdk] 7.0.302 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.5 [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
cmake twxs 0.0.17 twxs.cmake-0.0.17
cmake-tools ms-vscode 1.15.31 ms-vscode.cmake-tools-1.15.31
code-spell-checker streetsidesoftware 2.20.5 streetsidesoftware.code-spell-checker-2.20.5
cpptools ms-vscode 1.17.3 ms-vscode.cpptools-1.17.3-win32-x64
cpptools-extension-pack ms-vscode 1.3.0 ms-vscode.cpptools-extension-pack-1.3.0
cpptools-themes ms-vscode 2.0.0 ms-vscode.cpptools-themes-2.0.0
csdevkit ms-dotnettools 0.3.21 ms-dotnettools.csdevkit-0.3.21-win32-x64
csharp ms-dotnettools 2.0.376 ms-dotnettools.csharp-2.0.376-win32-x64
gitlens eamodio 14.2.1 eamodio.gitlens-14.2.1
hlsl-linter A2K 0.3.9 a2k.hlsl-linter-0.3.9
hlsltools TimGJones 1.1.303 timgjones.hlsltools-1.1.303
shader slevesque 1.1.5 slevesque.shader-1.1.5
vim vscodevim 1.25.2 vscodevim.vim-1.25.2
vscode-dotnet-runtime ms-dotnettools 1.7.0 ms-dotnettools.vscode-dotnet-runtime-1.7.0
vscode-eslint dbaeumer 2.4.2 dbaeumer.vscode-eslint-2.4.2
vscode-wakatime WakaTime 24.2.1 wakatime.vscode-wakatime-24.2.1
vscodeintellicode-csharp ms-dotnettools 0.1.26 ms-dotnettools.vscodeintellicode-csharp-0.1.26-win32-x64
vstuc visualstudiotoolsforunity 0.9.0 visualstudiotoolsforunity.vstuc-0.9.0

Extension version: 2.0.376 VS Code version: Code 1.81.1 (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:22:42.175Z) OS version: Windows_NT x64 10.0.19044 Modes:

spajus avatar Aug 19 '23 08:08 spajus

This issue is still there in v2.3.27. To clarify, the actual behavior is "Constructor hints do not show up. Hint for enclosing method call is shown instead (hint for List<T>.Add in OP's repro example)."

russop avatar Sep 27 '23 08:09 russop

Still happening in today's v2.5.30 release as well.

SeijiSuenaga avatar Oct 05 '23 00:10 SeijiSuenaga

Been a while... Still happening in v2.15.30.

SeijiSuenaga avatar Feb 06 '24 20:02 SeijiSuenaga