Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode.Diagnostic.relatedInformation is stale (incorrectly cached?) after it's updated with the relatedInformation removed #151385

Open
sean-mcmanus opened this issue Jun 7, 2022 · 0 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug error-list Problems view
Milestone

Comments

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Jun 7, 2022

Does this issue occur when all extensions are disabled?: Yes (but my repro is with the C/C++ extension)

  • VS Code Version: 1.67.2 or
  • Version: 1.68.0-insider (user setup)
    Commit: 87630a9
    Date: 2022-06-06T17:09:26.575Z
    Electron: 17.4.7
    Chromium: 98.0.4758.141
    Node.js: 16.13.0
    V8: 9.8.177.13-electron.0
    OS: Windows_NT x64 10.0.22000
  • OS Version: Windows (I suspect it repros with all OS's)

Steps to Reproduce:

  1. Do something to cause a vscode.Diagnostic object to be created that has a relatedInformation set.
  2. Do something to cause the same diagnostic to be set but with the relatedInformation not set (either missing or set to undefined).

Bug: The VS Code UI doesn't remove the relatedInformation from the diagnostic in the Problems windows. If the Problems tab is switched to another tab and then back, the child disappears, but the parent UI node still renders with an empty child expansion widget on the left. See the screenshot (top half is before a refresh is triggered, and the bottom half is after the UI refreshes):
image

Repro details for the C/C++ extension are:

  1. Install the C/C++ extension version 1.10.4 (pre-release) or later (1.9.8 is not sufficient).
  2. Add setting
"C_Cpp.codeAnalysis.clangTidy.checks.enabled": [
        "*"
    ]
  1. Create a test.cpp with
#include <algorithm>
#include <cstdlib>
#include <numeric>
#include <atomic>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfenv>
#include <cfloat>
#include <cinttypes>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>

NOTE: It's possible this step may require Windows with VS 2022 C++ build tools installed, not sure. I could look into a Linux/Mac repro if you want.
3. Use the "C/C++: Run Code Analysis on Active File" command.
4. Select the "Fix..." code action for the "duplicate include" problem. See the screenshot:
image
5. Save the document and then wait for the flame icon in the status bar to disappear, which indicates the Problem window has been updated with a diagnostic that has the relatedInformation removed -- the correctness of this code has been verified via debugging our TypeScript code, and the fact that the child object disappears after the UI is "refreshed" (but with an empty child) also reinforces the conclusion that it's a VS Code UI issue, because our extension code is not involved at that point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug error-list Problems view
Projects
None yet
Development

No branches or pull requests

2 participants