microsoft / vscode-docker

Docker Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker
Other
1.21k stars 515 forks source link

There is no label "recently used" next to the used context after executing "Use" action #4115

Closed v-xinda closed 11 months ago

v-xinda commented 11 months ago

OS: All Build Version: 20231012.1 Regression: Not a regression

Repro Steps:

  1. Expand "Contexts" view.
  2. Right click the unused context (like "default") -> Click "Use".
  3. F1 -> Docker Contexts: Use.
  4. Check whether there is a label "recently used" next to the used context.

Expect: There is a a label "recently used" next to the used context.

Screenshot 2023-10-12 at 16 37 59

Actual: There is no label "recently used" next to the used context.

Screenshot 2023-10-12 at 16 39 24

More Info:

  1. This issue doesn't reproduce after executing "Docker Contexts: Use" twice for the same context from command palette.
  2. On Windows, if you want to change the context "desktop-linux" to "desktop-windows", the label still doesn't appear after executing "Docker Contexts: Use" twice.
alexyaang commented 11 months ago

@bwateratmsft We haven't touched this side of the extension, I'm thinking this could be related to the Docker Desktop update?

bwateratmsft commented 11 months ago

No, this "recently used" behavior is provided by the @microsoft/vscode-azext-utils package. Could be an update there busted it. We should investigate if the problem is widespread or just affecting contexts; if it's only contexts then it can definitely wait.

alexyaang commented 11 months ago

Okay sounds good.

alexyaang commented 11 months ago

@bwateratmsft It still works on Docker Images: Run, so i think we should be okay. Is there any other command we should see if this works on?

bwateratmsft commented 11 months ago

I think I figured out what's happening. The underlying objects are changing--i.e. from "selected = false" to "selected = true"--so the hash code changes and recently used doesn't work. If you choose the same context several times in a row (even though to do so is redundant), it starts working again because the object doesn't change when it's already selected: image

I think we can won't-fix since it using the same context over and over again isn't something users need to do.