IDE0007 'use var' error stays after the code already uses var (stale diagnostic, source shown as 'cpp')
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 40/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- csharp, typescript
- 領域
- devtools, testing-qa
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 185
- フォーク
- 12
- 平均マージ
- 7時間 33分
- マージ済み PR(30日)
- 63
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Nimblesite/SharpLsp のほかの issue
-
Fix All + Enforce overwrites unsaved edits to .editorconfig / Directory.Build.props / sharplsp.tomlオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
Nimblesite/SharpLsp#644 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Nimblesite/SharpLsp#641 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Nimblesite/SharpLsp#640 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Nimblesite/SharpLsp#639 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Nimblesite/SharpLsp#510 ·
メンテナーはふだん 1 日以内に返信
Nimblesite/SharpLsp の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
audacity/audacity.github.io#118 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
crxjs/chrome-extension-tools#1261 ·
-
Resources: Update work of fuzhou対応中かも @rmt-svc が今日担当しました。 オープンresources
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
railmapgen/rmp-gallery#4245 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
mike-north/AgentMonitors#717 ·
メンテナーはふだん 1 日以内に返信