Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method overload completion no offered when expect in Razor file and generated code is incorrectly formatted or missing method body #855

Open
danroth27 opened this issue Jan 12, 2024 · 4 comments
Assignees
Labels
area-razor bug Something isn't working
Milestone

Comments

@danroth27
Copy link
Member

danroth27 commented Jan 12, 2024

Type: Bug

  • Create a Blazor Web App
  • In Counter.razor try to add a method overrload for OnInitialized() by typing override and then a space in the code block.

Expected result: Completion list offers list of methods to override like it does in VS
Actual result: No completion list
Workaround: Start typing the desired method to override.

  • Start typing OnInitialized and then select the method from the completion list.

Expected result: Method is generated with correct formatting.
Actual result: Generated override is incorrectly indented:

@code {
    private int currentCount = 0;

        protected override void OnInitialized()
        {
            base.OnInitialized();
        }
        private void IncrementCount()
    {
        currentCount++;
    }
}

Code_rqv76Gla4m

  • I've also seen some cases where I complete OnInitialized() and it only completes the method name and not the method body. But this doesn't repro reliably:

Code_qRZHVT4hEI

Error from the output window:

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\\78ae940c"}
received named pipe information from server
attempting to connect client to server...
client has connected to server
[Info  - 1:11:53 PM] [Program] Language server initialized
[Info  - 1:11:58 PM] [WorkspaceProjectFactoryService] Project C:\Users\daroth\source\repos\BlazorApp32\BlazorApp32\BlazorApp32.csproj loaded by C# Dev Kit
[roslyn.client.completionComplexEdit] Failed to make a complex text edit for completion.
[roslyn.client.completionComplexEdit] Can't find visible document with uri.fsPath: 'c:\Users\daroth\source\repos\BlazorApp32\BlazorApp32\Components\Pages\Home.razor__virtual.cs' and uri.path: '/c:/Users/daroth/source/repos/BlazorApp32/BlazorApp32/Components/Pages/Home.razor__virtual.cs'
[roslyn.client.completionComplexEdit] URIs of all visible documents:
[roslyn.client.completionComplexEdit] - uri.fsPath: 'c:\Users\daroth\source\repos\BlazorApp32\BlazorApp32\Components\Pages\Home.razor' and uri.path: '/c:/Users/daroth/source/repos/BlazorApp32/BlazorApp32/Components/Pages/Home.razor'

Extension version: 1.3.2
VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:49:37.021Z)
OS version: Windows_NT x64 10.0.22621
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 x 3600)
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 63.84GB (39.31GB free)
Process Argv --crash-reporter-id 4f9325b6-0f0b-4512-95c8-0e78b95da0c9
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
vsclangdf:30486550
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30933248
pythongtdpath:30769146
i26e3531:30792625
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
aa_t_chat:30882232

@danroth27 danroth27 changed the title Method overload completion no offered when expect in Razor file and generated code is incorrectly formatted Method overload completion no offered when expect in Razor file and generated code is incorrectly formatted or missing method body Jan 12, 2024
@webreidi webreidi added the bug Something isn't working label Jan 12, 2024
Copy link

github-actions bot commented Apr 3, 2024

This issue has been marked as stale after 14 days of inactivity. @[ @ @], could you please take a look?

@phil-allen-msft phil-allen-msft added this to the July2024 milestone May 7, 2024
@ryzngard ryzngard modified the milestones: July2024, Aug2024 Aug 12, 2024
@ryzngard
Copy link
Member

I also have seen where inserting the completion does not work at all. This was in a WSL environment with version v2.39.29

f7c0fe76-6a38-48bf-bb1a-7d929c23ba8b

@webreidi
Copy link

@alexgav moving to October milestone, as August is closed.

@webreidi webreidi modified the milestones: Aug2024, Oct2024 Sep 26, 2024
@phil-allen-msft phil-allen-msft modified the milestones: Oct2024, Dec2024 Nov 13, 2024
@drzbida
Copy link

drzbida commented Nov 27, 2024

This is very likely to be an issue from the LSP server as we have the same issue as ryzngard in neovim using Roslyn. Here it doesn't work even for normal C# code, so I expect that it was somehow partially patched directly in vscode

seblj/roslyn.nvim#72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-razor bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants