IDE0007 'use var' error stays after the code already uses var (stale diagnostic, source shown as 'cpp')
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
- 40/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- csharp, typescript
- Área
- devtools, testing-qa
Línea de trabajo
Start by tracing the diagnostic pull for an edited document and how AnalyzerDiagnosticResolver caches results across document versions; the issue also points to to_lsp_diagnostic and editor middleware for the cpp source label. Reproduce with IDE0007 enforced, change explicit local types to var, then check that the next document pull clears the diagnostics and reports a C# engine source. The issue names no test file or entry point.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug
After explicit local types are changed to var, the IDE0007 error ("use 'var' instead of explicit type") stays on every changed line. The diagnostic is stale: it describes code that no longer exists.
Seen (VS Code, macOS, C# web app Program.cs)
var builder = WebApplication.CreateBuilder(args);
var devCertPath = builder.Configuration["DevCert:Path"];
var devHttps = builder.Environment.IsDevelopment() && File.Exists(devCertPath);
if (devHttps)
{
var devCertPassword = builder.Configuration["DevCert:Password"];
...
}
- Lines 4, 10, 11 and 14 already use
var; the inlay hints show the inferred types (string?,bool). Eachvarstill has a red squiggle. - Hover shows:
use 'var' instead of explicit type (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0007) cpp(IDE0007), with a Fix action still offered. - The source shows as
cpp, notsharplsp-csharp. A wrong source label is a second bug, and it also suggests this diagnostic is not coming through the normal C# diagnostic path.
Expected
- Once a line uses
var, IDE0007 clears from it on the next document pull (on change or save), without a reload. - The diagnostic's
sourcenames the C# engine, nevercpp.
Suspects
- The diagnostic pull for the edited document returns a stale or cached result (the
resultIdis reused, or an unchanged report is sent after an edit), or a pushed set is never replaced by the pulled one. - The IDE0007 rule set and severity come from the Fix All / enforce work (#577,
[FIXALL-LSP]);AnalyzerDiagnosticResolverresults may be cached per document version and not invalidated bydidChange. - Where the
cppsource label is set (to_lsp_diagnosticsource tag, or the editor middleware).
Repro
- Have IDE0007 enforced as an error (for example,
csharp_style_var_* = true:errorin.editorconfig). - Open a C# file with explicit local types; IDE0007 errors appear.
- Change the types to
varby hand, or apply the fix. - The errors stay on the
varlines.
Keep this issue open until the latest published release's own binaries clear the diagnostic.
- Lenguaje dominante
- TypeScript
- Estrellas
- 185
- Forks
- 12
- Merge medio
- 7 h 33 min
- PR fusionados (30 d)
- 63
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Nimblesite/SharpLsp
-
Fix All + Enforce overwrites unsaved edits to .editorconfig / Directory.Build.props / sharplsp.tomlAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Nimblesite/SharpLsp#644 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Nimblesite/SharpLsp#641 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Nimblesite/SharpLsp#640 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Nimblesite/SharpLsp#639 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Nimblesite/SharpLsp#510 ·
Los mantenedores suelen responder en 1 día
Todos los issues de Nimblesite/SharpLsp
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
audacity/audacity.github.io#118 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
crxjs/chrome-extension-tools#1261 ·
-
Resources: Update work of fuzhouPosiblemente ocupada @rmt-svc la tomó hoy. Abiertoresources
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
railmapgen/rmp-gallery#4245 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
mike-north/AgentMonitors#717 ·
Los mantenedores suelen responder en 1 día