Skip to content

No Quick Fix to add using statemens in Razor files #9946

@julioct

Description

@julioct

Environment data

VSCode version: 1.86.1
C# Extension: 2.15.30
Using OmniSharp: false

OmniSharp 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\bd3107d0"}
received named pipe information from server
attempting to connect client to server...
client has connected to server
[Info - 5:25:54 PM] [Program] Language server initialized
[Info - 5:25:58 PM] [WorkspaceProjectFactoryService] Project D:\projects\AspnetCore_FullStack\GameStore.Client\GameStore.Client.csproj loaded by C# Dev Kit
[Info - 5:25:58 PM] [WorkspaceProjectFactoryService] Project D:\projects\AspnetCore_FullStack\GameStore.Server\GameStore.Server.csproj loaded by C# Dev Kit
Using dotnet configured on PATH

Steps to reproduce

  1. Create a Blazor WASM project
  2. Add a class in some nested namespace:
namespace GameStore.Client.Models;

public class Game
{
    public int Id { get; set; }

    public required string Name { get; set; }
}
  1. Create a razor file with a code section that tries to use the clase above:
@code {
  [Parameter]
  public Game? Game { get; set; }
}
  1. Click on the red squiggles under the type name and open the contextual Quick Fix:

image

Expected behavior

There should be an option to import the Models namespace, as there was one before:

image

Actual behavior

There's no option to import the Models namespace in this case.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions