Diagnostics published for `git:` documents in the diff editor: project usings faded as unnecessary (IDE0005)

Aperta
#9,944 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start with the repro in FreHu/csharp-diff-usings-repro and its README, then open a C# file in a working-tree diff to compare the file: and git: sides. Read the earlier fix in dotnet/roslyn#85886 and the related issue #9831 to see how git: documents are currently analysed. Done when git: documents publish no diagnostics, the file: side still does, and hover and colouring still work on the historical side.

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

Descrizione

untriaged

Issue Description

When a C# file is opened in the diff editor, the historical side (a git: document) is analysed as a miscellaneous file: framework references only, no project. Every using of a project namespace then fails to resolve and is faded as Using directive is unnecessary. (IDE0005). In a real codebase, where most usings are project namespaces, nearly every using on the historical side of every diff is faded.

The working-tree (file:) side of the same diff is analysed correctly.

Same root cause as #9831. Its fix (dotnet/roslyn#85886) stopped the Razor syntax errors on these documents but diagnostics are still published for them.

Steps to Reproduce

Repro: https://github.com/FreHu/csharp-diff-usings-repro. Steps are in its README.

I originally noticed this with C# Dev Kit installed; the repro uses a profile with only the C# extension to rule it out.

Expected Behavior

No diagnostics on git: documents. They are past, read-only versions: nothing reported on them can be acted on, and without project context the analysis is wrong. The file: side of a working-tree diff keeps normal diagnostics. Hover, navigation and semantic colouring on the historical side are welcome to stay.

Actual Behavior

  • using Repro.Models; (project namespace) is faded with IDE0005 on every git: side; using System.Text; (framework) is not.
  • The file: side of a working-tree diff is correct. Invoice gets type colouring only there.

Environment

  • VS Code: 1.144.1
  • C#: 2.160.4
  • .NET SDK: 10.0.203
  • OS: Windows 10 Pro 10.0.19045
Lingua principale
TypeScript
Stelle
3.1k
Fork
742
Merge medio
1g 3h
PR unite (30g)
53

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.