Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Quick fix 'Change namespace' missing in preview version

Chiusa
#9,885 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #86126 di @dibarbet — chiusa senza merge
  • #86148 di @jasonmalinowski — integrata

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp, typescript, vscode

Direzione di ricerca

The payload names no source files, only the VS Code C# extension and the IDE0130 and IDE0161 diagnostics. Start by reproducing with a .cs file whose folder does not match its namespace, then compare the Quick Fix list on the Preview and Release channels. The code action is likely supplied by the Roslyn language server rather than this extension, so check which server version each channel ships. Done means the 'Change namespace to match folder structure' action appears on Preview, or the issue is routed to the upstream owner.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug Editor-Code Actions Roslyn LSP

Environment data

dotnet --info output:

PS C:\Users\gvpundik\Source\Repos\UniOrder\unoiorder> d --info
ПАКЕТ SDK ДЛЯ .NET:
 Version:           10.0.401
 Commit:            e34a38d2ae
 Workload version:  10.0.400-manifests.63b36e85
 MSBuild version:   18.9.11+e34a38d2a

Среда выполнения:
 OS Name:     Windows
 OS Version:  10.0.19044
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\10.0.401\

Установленные рабочие нагрузки .NET:
Нет установленных рабочих нагрузок для отображения.
Настроено на использование workload sets при установке новых манифестов.
Наборы рабочих нагрузок не установлены. Запустите команду "dotnet workload restore", чтобы установить набор рабочей нагрузки.

Host:
  Version:      10.0.12
  Architecture: x64
  Commit:       95017c711e

.NET SDKs installed:
  10.0.401 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 10.0.12 [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

VS Code version: 1.142.0
C# Extension version: 3.40.210

C# logs

C# output window contents:

See this page for collecting more detailed logs

Steps to reproduce

  1. Create a C# project structure where a file's physical directory layout does not match its declared namespace.
  2. Ensure you are using the new .slnx solution format (or a standard .sln) and the latest Preview channel version of the C# / C# Dev Kit extensions.
  3. Open the .cs file in the editor.
  4. Notice that the IDE0130 diagnostic warning ("Namespace does not match folder structure") successfully triggers and highlights the namespace declaration.
  5. Click on the lightbulb icon or press Ctrl + . (Quick Fix / Quick Actions) on the highlighted namespace.

Expected behavior

The Quick Fix menu should contain the action "Change namespace to match folder structure" to automatically refactor and synchronize the namespace name based on the current directory path.

Actual behavior

The "Change namespace to match folder structure" code action is completely missing from the Quick Fix dropdown list. Only unrelated text style refactoring options (such as switching between block and file-scoped namespace styles - IDE0161) are available in the menu.

Additional context

This issue actual for preview version.

Image

Release version.

Image
Lingua principale
TypeScript
Stelle
3.1k
Fork
740
Merge medio
1g 3h
PR unite (30g)
52

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dotnet/vscode-csharp

Tutte le issue di dotnet/vscode-csharp

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.