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

Abierto
#9,944 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
42/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp, typescript, vscode

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
TypeScript
Estrellas
3.1k
Forks
742
Merge medio
1 d 3 h
PR fusionados (30 d)
53

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dotnet/vscode-csharp

Todos los issues de dotnet/vscode-csharp

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.